rbind_fill_id()
Implements the common pattern of
do.call(rbind, dfs)
with data frame identifier and filling of missing values.
rbind_fill_id(..., .id = NULL, .fill = NA) rbind_fill(..., .fill = NA)
... | The dataframes. Either a list of data frames, or a comma-separated list of dataframes. |
---|---|
.id | Data frame identifier. If a comma-separated list of data frames is supplied, the labels are taken from the names of the objects. When a list of data frames is supplied, the labels are taken from the names of the list. If no names are found, a numeric sequence is used instead. |
.fill | When row-binding, columns are matched by name, and any missing
columns will be filled with |
A data frame.
Tiago Olivoto tiagoolivoto@gmail.com
#> v1 v2 #> 1 1 2 #> 2 2 3#> v3 #> 1 4 #> 2 5rbind_fill_id(df1, df2)#> v1 v2 v3 #> 1 1 2 NA #> 2 2 3 NA #> 3 NA NA 4 #> 4 NA NA 5rbind_fill_id(df1, df2, .fill = ".", .id = "dfs")#> dfs v1 v2 v3 #> 1 df1 1 2 . #> 2 df1 2 3 . #> 3 df2 . . 4 #> 4 df2 . . 5#> dfs v1 v2 v3 #> 1 a 1 2 NA #> 2 a 2 3 NA #> 3 b NA NA 4 #> 4 b NA NA 5#> dfs v1 v2 v3 #> 1 1 1 2 NA #> 2 1 2 3 NA #> 3 2 NA NA 4 #> 4 2 NA NA 5# }