| endoapply {IRanges} | R Documentation |
Performs the endomorphic equivalents of
lapply and mapply by returning
objects of the same class as the inputs rather than a list.
endoapply(X, FUN, ...) mendoapply(FUN, ..., MoreArgs = NULL)
X |
a list, data.frame or List object. |
FUN |
the function to be applied to each element of |
... |
For |
MoreArgs |
a list of other arguments to |
endoapply returns an object of the same class as X,
each element of which is the result of applying FUN to the
corresponding element of X.
mendoapply returns an object of the same class as the first
object specified in ..., each element of which is the result
of applying FUN to the corresponding elements of ....
a <- data.frame(x = 1:10, y = rnorm(10)) b <- data.frame(x = 1:10, y = rnorm(10)) endoapply(a, function(x) (x - mean(x))/sd(x)) mendoapply(function(e1, e2) (e1 - mean(e1)) * (e2 - mean(e2)), a, b)