This function makes it easier to see which units or records are associated
with a particular level of factor.
The arguments closely follow tidyr::pivot_wider()
, but the major difference
is that it is aware of the relationships between columns and makes use of
this to present to you information without unnecessary duplication.
pivot_wider_by(
data,
id_cols = NULL,
id_expand = FALSE,
names_from = where(is_trt),
names_prefix = "",
names_sep = ":",
names_glue = NULL,
names_sort = FALSE,
names_vary = "fastest",
names_expand = FALSE,
names_repair = "check_unique",
values_from = NULL,
values_fill = NULL,
values_fn = NULL
)
An edibble table
Columns in the data where the levels correspond to a unique level on the row.
If multiple columns are selected, whether all combinations of the levels should be taken into account.
An expression specifying which columns to pivot from.
A prefix to add to the resulting column names.
A separator to use between column names in the resulting wide format.
A glue specification to control column names.
A logical indicating whether to sort the resulting column names.
A character vector of options to specify how to handle varying identifiers.
A logical indicating whether to expand identifiers in the column names.
A method to handle non-unique resulting column names.
A character vector specifying columns to use as values in the wide format.
A value or function to fill missing values.
A function to aggregate values.
split_by()
and count_by()