expand.tbl_lazy {dbplyr} | R Documentation |
This is a method for the tidyr::expand generics. It doesn't sort the
result explicitly, so the order might be different to what expand()
returns for data frames.
## S3 method for class 'tbl_lazy' expand(data, ..., .name_repair = "check_unique")
data |
A lazy data frame backed by a database query. |
... |
Specification of columns to expand. See tidyr::expand for more details. |
.name_repair |
Treatment of problematic column names:
This argument is passed on as |
Another tbl_lazy
. Use show_query()
to see the generated
query, and use collect()
to execute the query
and return data to R.
fruits <- memdb_frame( type = c("apple", "orange", "apple", "orange", "orange", "orange"), year = c(2010, 2010, 2012, 2010, 2010, 2012), size = c("XS", "S", "M", "S", "S", "M"), weights = rnorm(6) ) # All possible combinations --------------------------------------- fruits %>% tidyr::expand(type) fruits %>% tidyr::expand(type, size) # Only combinations that already appear in the data --------------- fruits %>% tidyr::expand(nesting(type, size))