| bcapply | R Documentation | 
The bcapply() function
applies a function to 2 arrays element-wise with broadcasting. 
bcapply(x, y, f, ...)
## S4 method for signature 'ANY'
bcapply(x, y, f, v = NULL)
x, y | 
 conformable atomic or recursive arrays.  | 
f | 
 a function that takes in exactly 2 arguments, and returns a result that can be stored in a single element of a recursive or atomic array.  | 
... | 
 further arguments passed to or from methods.   | 
v | 
 either   | 
An atomic or recursive array with dimensions bc_dim(x, y). 
Preserves some of the attributes of x and y similar to broadcasted infix operators,
as explained in broadcast_operators. 
 
x.dim <- c(5, 3, 2)
x.len <- prod(x.dim)
gen <- function(n) sample(list(letters, month.abb, 1:10), n, TRUE)
x <- array(gen(10), x.dim)
y <- array(1:5, c(5, 1, 1))
f <- function(x, y) strrep(x, y)
bcapply(x, y, f, v = "character")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.