This function is primarily a wrapper for separate, which
turns a single character column into multiple columns
Usage
separate_tidy(
data,
col,
into = NULL,
sep = "_",
coerce_NA = TRUE,
na.strings = "NA",
message_inferred_into = TRUE,
...
)Arguments
- data
A
data.frame- col
Column name or position
- into
A
charactervectorof the new column names. UseNAto omit the variable in the output.If
NULL,separate_tidywill attempt to infer the new column names by splitting the column name ofcol- sep
Separator between columns passed to separate:
If
character,sepis interpreted as a regular expression.If
numeric,sepis interpreted as character positions to split at. Positive values start at 1 at the far-left of thestring; negative values start at -1 at the far-right of thestring. The length ofsepshould be one less thaninto- coerce_NA
logicaldictating ifstrings matching any ofna.stringswill be coerced intoNAvalues after separating.- na.strings
A
charactervectorofstrings which are to be interpreted asNAvalues ifcoerce_NA == TRUE- message_inferred_into
logicalwhether column names forintoshould be printed in a message when inferred- ...
Other arguments passed to separate