Separate columns
Usage
separate_var(data, var, by, names, into = c("cols", "rows"))Arguments
- data
dataset
- var
name of variable to be separated
- by
a string as delimiter between values (separate by delimiter) or integer(s) as number of characters to split by (separate by position), the length of
byshould be1unlessbyis integer andinto = "cols"; ifbyis a non-integer numeric vector its values will be rounded down to the nearest integer- names
for
into = "cols", a character vector of output column names; useNAif there are components that you don't want to appear in the output; the number of non-NAelements determines the number of new columns in the result- into
whether to split into new rows or columns