add_missing_combinations: Add missing combinations of x and y to a data frame

Description Usage Arguments Value Examples

View source: R/asymmetrise.R

Description

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().

Usage

1

Arguments

df

a data frame (or tibble) object

.x, .y

column names to make combinations of

Value

a data frame (or tibble) with additional columns

Examples

1
2
3
4
5
6
7
8
df <- data.frame(
  a = c("A", "B"),
  b = c("C", "D"),
  untouched = c(1, 2)
)
df

add_missing_combinations(df, a, b)

jhrcook/ggasym documentation built on July 12, 2021, 3:27 a.m.