If you have a tibble with two list columns,
data_sets <- iris %>% split(iris$Species)
formulas <- list(formula1 = Sepal.Length ~ Sepal.Width,
formula2 = Sepal.Length ~ Sepal.Width + Petal.Width,
formula3 = Sepal.Length ~ Sepal.Width + Petal.Width + Petal.Length)
(demo <- tibble(formulas = formulas, data_sets = data_sets))
## # A tibble: 3 x 2
## formulas data_sets
## <list> <list>
## 1 <S3: formula> <data.frame [50 × 5]>
## 2 <S3: formula> <data.frame [50 × 5]>
## 3 <S3: formula> <data.frame [50 × 5]>
You cannot use complete or expand to enumerate all of the combinations (which would be handy).
demo %>% complete(formulas, data_sets)
## Error: Each element must be either an atomic vector or a data frame.
## Problems: formulas, data_sets.
demo %>% expand(formulas, data_sets)
## Error: Each element must be either an atomic vector or a data frame.
## Problems: formulas, data_sets.
I'd want the results that expand.grid delivers
expand.grid(formulas = demo$formulas, data_sets = demo$data_sets)
as_tibble(expand.grid(formulas = formulas, data_sets = data_sets))
## # A tibble: 9 x 2
## formulas data_sets
## <list> <list>
## 1 <S3: formula> <data.frame [50 × 5]>
## 2 <S3: formula> <data.frame [50 × 5]>
## 3 <S3: formula> <data.frame [50 × 5]>
## 4 <S3: formula> <data.frame [50 × 5]>
## 5 <S3: formula> <data.frame [50 × 5]>
## 6 <S3: formula> <data.frame [50 × 5]>
## 7 <S3: formula> <data.frame [50 × 5]>
## 8 <S3: formula> <data.frame [50 × 5]>
## 9 <S3: formula> <data.frame [50 × 5]>
If you have a tibble with two list columns,
You cannot use
completeorexpandto enumerate all of the combinations (which would be handy).I'd want the results that
expand.griddelivers