pivot_longer_spec {tidyr} | R Documentation |
This is a low level interface to pivotting, inspired by the cdata package, that allows you to describe pivotting with a data frame.
pivot_longer_spec(data, spec, names_repair = "check_unique", values_drop_na = FALSE, values_ptypes = list()) build_longer_spec(data, cols, names_to = "name", values_to = "value", names_prefix = NULL, names_sep = NULL, names_pattern = NULL, names_ptypes = NULL)
data |
A data frame to pivot. |
spec |
A specification data frame. This is useful for more complex pivots because it gives you greater control on how metadata stored in the column names turns into columns in the result. Must be a data frame containing character |
names_repair |
What happen if the output has invalid column names?
The default, |
values_drop_na |
If |
values_ptypes |
A list of of column name-prototype pairs.
A prototype (or ptype for short) is a zero-length vector (like If not specified, the type of the columns generated from |
cols |
Columns to pivot into longer format. This takes a tidyselect specification. |
names_to |
A string specifying the name of the column to create
from the data stored in the column names of Can be a character vector, creating multiple columns, if |
values_to |
A string specifying the name of the column to create
from the data stored in cell values. If |
names_prefix |
A regular expression used to remove matching text from the start of each variable name. |
names_sep |
If
If these arguments does not give you enough control, use
|
names_pattern |
If
If these arguments does not give you enough control, use
|
names_ptypes |
A list of of column name-prototype pairs.
A prototype (or ptype for short) is a zero-length vector (like If not specified, the type of the columns generated from |