lapply {MethylIT} | R Documentation |
lapply returns a list of the same length as 'x', each element of which is the result of applying FUN to the corresponding element of 'x'.
lapply(x, FUN, ...) ## Default S3 method: lapply(x, FUN, keep.attr = FALSE, ...)
x |
A list-like or vector-like object |
FUN, ... |
See ?base:: |
keep.attr |
Logic. If TRUE, then the original attributes from 'x' are preserved in the returned list. Derfaul is FALSE. |
Same as in ?base::lapply
if keep.attr = FALSE.
Otherwise same values preserving original attributes from 'x'.
base::lapply
# Create a list x <- list(a = 1:10, beta = exp(-3:3), logic = c(TRUE,FALSE,FALSE,TRUE)) class(x) <- "nice" # compute the list mean for each list element using 'base::lapply' class(lapply(x, mean)) # To preserve attributes class(lapply(x, mean, keep.attr = TRUE))