mapply {base} | R Documentation |
Apply a function to multiple list or vector arguments
Description
A multivariate version of sapply
.
mapply
applies FUN
to the first elements of each ...
argument, the second elements, the third elements, and so on.
Arguments are recycled if necessary.
Usage
mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE)
Arguments
FUN |
Function to apply |
... |
Arguments to vectorise over (list or vector) |
MoreArgs |
A list of other arguments to |
SIMPLIFY |
Attempt to reduce the result to a vector or matrix? |
USE.NAMES |
If the first ... argument is character and the result doesn't already have names, use it as the names |
Value
A list, vector, or matrix.
See Also
sapply
,
outer
Examples
mapply(rep, 1:4, 4:1)
mapply(rep, times=1:4, x=4:1)
mapply(rep, times=1:4, MoreArgs=list(x=42))