Skip to contents

Bind_rows works until there are factors with a set of different levels then it throws a wobbly. This handles that particular situation by combining factor levels.

Usage

bind_rows_with_factors(...)

Arguments

...

a list of dataframes

Value

the union of those dataframes. Factor levels are combined with a superset of all levels

Examples

library(tidyverse)
bind_rows_with_factors(iris,
 ggplot2::diamonds %>% dplyr::rename(Species = cut)) %>%
 dplyr::pull(Species) %>%
 levels()
#> [1] "setosa"     "versicolor" "virginica"  "Fair"       "Good"      
#> [6] "Very Good"  "Premium"    "Ideal"