Essentially a wrapper for pivot_longer that works on both a single wide-shaped dataframe as well as a list of wide-shaped dataframe's
Usage
trans_wide_to_tidy(
wides,
data_cols = NA,
id_cols = NA,
names_to = "Well",
values_to = "Measurements",
values_to_numeric = TRUE,
...
)
Arguments
- wides
A single wide-shaped dataframe, or a list of wide-shaped dataframe's
- data_cols, id_cols
Specifies which columns have data vs are ID's (in pivot_longer parlance). Each can be a single vector (which will be applied for all dataframes) or a list of vectors, with each vector corresponding to the same-index dataframe in
wides
Entries that are NA in the list will not be used
If neither
data_cols
norid_cols
are specified, user must provide arguments to pivot_longer via...
for at least thecols
argument and these arguments provided via...
will be used for allwides
dataframe's- names_to, values_to
Specifies the output column names created by pivot_longer. Each can be provided as vectors the same length as
wides
- values_to_numeric
logical indicating whether values will be coerced to numeric. See below for when this may be overridden by arguments passed in
...
- ...
Other arguments to be passed to pivot_longer Note that including
values_transform
here will override the behavior ofvalues_to_numeric