.BG
.FN lapply
.TL
Apply a Function to Elements of a List
.CS
lapply(X, FUN, ...)
.AG X
a list.
.AG FUN
function (or
character string giving the name of the function) to be
applied to the specified array sections.
The character form is necessary only for functions with
unusual names, e.g., "/".
.AG ...
optional, any arguments to `FUN'; they are passed unchanged.
.RT
a list like `X' where each element of the list has been replaced
by the result of executing `FUN' on that element.
.SA
`apply' applies a function to specified subsets of an array.
`sapply' is a more complex version of applying to a list.
`tapply' is useful for ragged arrays.
.EX
#apply mean function to each element of list x
lapply(x,mean)

l <- as.list(1:5)
# generate a list with elements 1, 1:2, 1:3, ...
lapply(l,seq)

#generate a list with elements 1, c(2,2), c(3,3,3), ...
lapply(l,function(x)rep(x,x))
.KW iteration
.KW algebra
.WR
