mapply(FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE)
- 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 the
- 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 but may be handled as their base types.
A list, or for
SIMPLIFY = TRUE, a vector, array or list.
outer, which applies a vectorized function to all combinations of two arguments.
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))
Documentation reproduced from R 2.15.3. License: GPL-2.