Convenient wrapper around do.call("rbind", ...) that (a) sets the 'quote' argument to TRUE and (b) fills data frames with missing columns with NAs of the appropriate class.

bind_rows_data(..., fill = FALSE)

Arguments

...

Input data frames or list of data frames

fill

Logical indicating whether to fill missing columns in data frames with missing values.

Value

The list collapsed into a single data frame

Examples

## list of data frames with inconsistent columns x <- as_tbl_data(mtcars[1:3, ]) xx <- x xx$y <- "a" l <- list(x, xx, mtcars) ## bind rows and fill missing columns with NAs bind_rows_data(l, fill = TRUE)
#> # A tibble: 38 x 12 #> mpg cyl disp hp drat wt qsec vs am gear carb y #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 NA #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 NA #> 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 NA #> 4 21 6 160 110 3.9 2.62 16.5 0 1 4 4 a #> 5 21 6 160 110 3.9 2.88 17.0 0 1 4 4 a #> 6 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 a #> 7 21 6 160 110 3.9 2.62 16.5 0 1 4 4 NA #> 8 21 6 160 110 3.9 2.88 17.0 0 1 4 4 NA #> 9 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 NA #> 10 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 NA #> # … with 28 more rows