Standard-evaluation version of
This is a S3 generic.
separate_(data, col, into, sep = "[^[:alnum:]]+", remove = TRUE, convert = FALSE, extra = "warn", fill = "warn", ...)
- A data frame.
- Name of column to split, as string.
- Names of new variables to create as character vector.
- Separator between columns.
If character, is interpreted as a regular expression. The default value is a regular expression that matches any sequence of non-alphanumeric values.
If numeric, interpreted as positions to split at. Positive values start at 1 at the far-left of the string; negative value start at -1 at the far-right of the string. The length of
sepshould be one less than
TRUE, remove input column from output data frame.
TRUE, will run
as.is = TRUEon new columns. This is useful if the component columns are integer, numeric or logical.
sepis a character vector, this controls what happens when there are too many pieces. There are three valid options:
- "warn" (the default): emit a warning and drop extra values.
- "drop": drop any extra values without a warning.
- "merge": only splits at most
sepis a character vector, this controls what happens when there are not enough pieces. There are three valid options:
- "warn" (the default): emit a warning and fill from the right
- "right": fill with missing values on the right
- "left": fill with missing values on the left
- Defunct, will be removed in the next version of the package.