TITLE(split @@ Divide into Groups)
USAGE(
split(x, groups)
)
ALIAS(split)
ARGUMENTS(
ARG(x @@ vector containing the values to be divided into groups.)
ARG(group @@ a factor which defines the grouping.)
)
DESCRIPTION(
LANG(split) divides the data in the vector LANG(x)
into the groups defined by the factor LANG(groups).
PARA
The value returned is a list of vectors containing the values
for the groups.
The components of the list are named by the factor levels of LANG(group).
)
EXAMPLES(
n <- 10; nn <- 100
g <- factor(round(n * runif(n*nn)))
x <- rnorm(n*nn) + sqrt(codes(g))
xg <- split(x,g)
boxplot(xg, col="lavender", notch=TRUE, varwidth= TRUE)
sapply(xg, length)
sapply(xg, mean)
## Split a matrix into a list by columns
ma <- cbind(x = 1:10, y = (-4:5)^2)
split(ma, col(ma))
)
