Learn R Programming

iNZightTools (version 2.0.1)

separate_var: Separate columns

Description

Separate columns

Usage

separate_var(data, var, by, names, into = c("cols", "rows"))

Value

Separated dataset

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 be 1 unless by is integer and into = "cols"; if by 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; use NA 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

Author

Zhaoming Su