R/asymmetrise.R
add_missing_combinations.Rd
Add rows to df
to complete all combinations of
columns .x
and .y
. Importantly, this function observes and
maintains any groups created by dplyr::group_by()
.
add_missing_combinations(df, .x, .y)
df | a data frame (or tibble) object |
---|---|
.x, .y | column names to make combinations of |
a data frame (or tibble) with additional columns
#> a b untouched #> 1 A C 1 #> 2 B D 2add_missing_combinations(df, a, b)#> a b untouched #> 1 A C 1 #> 2 B D 2 #> 3 A A NA #> 4 B A NA #> 5 C A NA #> 6 D A NA #> 7 A B NA #> 8 B B NA #> 9 C B NA #> 10 D B NA #> 11 B C NA #> 12 C C NA #> 13 D C NA #> 14 A D NA #> 15 C D NA #> 16 D D NA