% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helper-colsplit.r
\name{colsplit}
\alias{colsplit}
\title{Split a vector into multiple columns}
\usage{
colsplit(string, pattern, names)
}
\arguments{
\item{string}{character vector or factor to split up}

\item{pattern}{regular expression to split on}

\item{names}{names for output columns}
}
\description{
Useful for splitting variable names that a combination of multiple
variables. Uses \code{\link{type.convert}} to convert each column to
correct type, but will not convert character to factor.
}
\examples{
x <- c("a_1", "a_2", "b_2", "c_3")
vars <- colsplit(x, "_", c("trt", "time"))
vars
str(vars)
}
\keyword{manip}
