Hello,
When running the code below, the error "longer argument not a multiple of length of shorter" appears.
Would it be possible to apply my function to all the combinations of each element from each vector, even if these are not the same length? In my example below I should get 24 elements (432) in the resulting vector.
Thank you for your help!
a <- c(0,1,2,3)
p <- c(1,2,3)
M <- c(1,23)
calc_mass <- function(a,p,M)
{
mass <- (a*M)/p
return(mass)
}
masses_apply <- mapply(calc_mass,a,p,M)