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 Sequence object. |
FUN |
the function to be applied to each element of X
(for endoapply ) or for the elements in ...
(for mendoapply ). |
... |
For endoapply , optional arguments to FUN .
For mendoapply , a set of list, data.frame or Sequence
objects to compute over. |
MoreArgs |
a list of other arguments to FUN . |
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)