expand.: Expand a data.table to use all combinations of values

Description Usage Arguments Examples

View source: R/expand.R

Description

Generates all combinations of variables found in a dataset.

expand.() is useful in conjunction with joins:

nesting.() is a helper that only finds combinations already present in the dataset.

Usage

1
2
3
expand.(.df, ..., .name_repair = "check_unique")

nesting.(..., .name_repair = "check_unique")

Arguments

.df

A data.frame or data.table

...

Columns to get combinations of

.name_repair

Treatment of duplicate names. See ?vctrs::vec_as_names for options/details

Examples

1
2
3
4
5
6
7
test_df <- tidytable(x = c(1, 1, 2), y = c(1, 1, 2))

test_df %>%
  expand.(x, y)

test_df %>%
  expand.(nesting.(x, y))

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.