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
by
should be1
unlessby
is integer andinto = "cols"
; ifby
is 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; useNA
if there are components that you don't want to appear in the output; the number of non-NA
elements determines the number of new columns in the result- into
whether to split into new rows or columns