Reducio - Condense Wide Data into Long Format
reducio.Rd
reducio
magically condenses wide-format data into a longer, more detailed
format, mirroring the functionality of tidyr::pivot_longer()
. This function
is ideal for gathering multiple columns into key-value pairs, thereby
stretching the data frame vertically and reducing its width.
Arguments
- data
A data frame or tibble that you wish to transform into a longer format.
- cols
Columns in
data
that you want to condense into longer format. Can be specified using dplyr select helpers likeeverything()
,starts_with()
,ends_with()
, etc.- names_to
The name of the new column in the long format that will contain the names of the condensed columns. Defaults to
"name"
.- values_to
The name of the new column in the long format that will contain the values from the condensed columns. Defaults to
"value"
.- ...
Additional arguments passed on to
tidyr::pivot_longer()
.
Value
A longer, more detailed data frame or tibble where specified wide-format
columns are condensed into two columns: one for the variable names (names_to
)
and one for the values (values_to
).
See also
Other data transformation functions:
engorgio()
,
transfiguro()