mapply is a multivariate version of
FUN to the first elements of each ...
argument, the second elements, the third elements, and so on.
Arguments are recycled if necessary.
function to apply, found via
arguments to vectorize over (vectors or lists of strictly positive length, or all of zero length). See also ‘Details’.
a list of other arguments to
logical or character string; attempt to reduce the
result to a vector, matrix or higher dimensional array; see
logical; use names if the first ... argument has names, or if it is a character vector, use that character vector as the names.
FUN for the values of
(re-cycled to the length of the longest, unless any have length zero),
followed by the arguments given in
MoreArgs. The arguments in
the call will be named if
MoreArgs are named.
Arguments with classes in
... will be accepted, and their
length methods will be used.
A list, or for
SIMPLIFY = TRUE, a vector, array or list.
sapply, after which
mapply() is modelled.
outer, which applies a vectorized function to all
combinations of two arguments.
1 2 3 4 5 6 7 8 9 10 11 12
mapply(rep, 1:4, 4:1) mapply(rep, times = 1:4, x = 4:1) mapply(rep, times = 1:4, MoreArgs = list(x = 42)) mapply(function(x, y) seq_len(x) + y, c(a = 1, b = 2, c = 3), # names from first c(A = 10, B = 0, C = -10)) word <- function(C, k) paste(rep.int(C, k), collapse = "") utils::str(mapply(word, LETTERS[1:6], 6:1, SIMPLIFY = FALSE))