The R Project SVN R

Rev

Rev 7002 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

\name{strsplit}
\title{Split the Strings in a Vector}
\usage{strsplit(x, split)}
\alias{strsplit}
\description{
  Split the strings in \code{x} into substrings according to the
  presence of substring \code{split} within them.
}
\arguments{
  \item{x}{character vector, to be split.}
  \item{split}{character string, to use as ``split''.  If \code{split}
    has length 0, \code{x} is split into single characters.  If
    \code{split} is a vector, it is re-cycled along \code{x}.}
}
\value{
  A list of length \code{length(x)} the \code{i}-th element of which
  contains the vector of splits of \code{x[i]}.
}
\seealso{
  \code{\link{paste}} for the reverse,
  \code{\link{grep}} and \code{\link{sub}} for string search and
  manipulation; further \code{\link{nchar}}, \code{\link{substr}}.
}
\examples{
noquote(strsplit("A text I want to display with spaces", NULL)[[1]])

x <- c("asfef","qwerty","yuiop[","b","stuff.blah.yech")
# split x on the letter e
strsplit(x,"e")
}
\keyword{character}