.BG
.FN sapply
.TL
Apply a Function to Elements of a List
.CS
sapply(X, FUN, ...)
.AG X
any S object; usually a list.
Missing values (`NA's) are allowed if `FUN' accepts them.
.AG FUN
function or character string giving the name of a function.
.AG ...
other arguments to `FUN', if any.
.RT
object whose first element is the result of `FUN'
applied to the first element of `X', and so on.
If all the
results are the same length, `sapply' returns a matrix with
one column for each component.  If all the results are
scalars, a vector is returned.
Otherwise a list of the results is returned.
.SA
`lapply' is a simplified version of `sapply'.
`lapply' calls a function for each element of a list
and returns a list.
Function `apply' can be used to perform similar operations
on the sections of a matrix or array, and `tapply' operates on
data classified by categorical variables.
.EX
sapply(x,mean) #vector of means of components of x
sapply(x,sort) # sort the components
.KW iteration
.WR
