powered by
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.
type.convert
colsplit(string, pattern, names)
character vector or factor to split up
regular expression to split on
names for output columns
# NOT RUN { x <- c("a_1", "a_2", "b_2", "c_3") vars <- colsplit(x, "_", c("trt", "time")) vars str(vars) # }
Run the code above in your browser using DataLab