colsplit

0th

Percentile

Split a vector into multiple columns

Useful for splitting variable names that a combination of multiple variables. Uses type.convert to convert each column to correct type, but will not convert character to factor.

Keywords
manip
Usage
colsplit(string, pattern, names)
Arguments
string

character vector or factor to split up

pattern

regular expression to split on

names

names for output columns

Aliases
  • colsplit
Examples
# NOT RUN {
x <- c("a_1", "a_2", "b_2", "c_3")
vars <- colsplit(x, "_", c("trt", "time"))
vars
str(vars)
# }
Documentation reproduced from package reshape2, version 1.4.3, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.