Was expecting a different output with the code bellow.
vec1 <- c(1, 2, 3, 4)
vec2 <- c(2, 4, 6, 8)
vec3 <- c(3, 6, 9, 12)
printer <- function(val1, val2, val3) {
print(c (val1, val2,val3))
}
mapply(printer, vec1, vec2, vec3, SIMPLIFY = T)
Expected:
[1] 1 2 3
[1] 2 4 6
[1] 3 6 9
[1] 4 8 12
Got this instead:
[1] 1 2 3
[1] 2 4 6
[1] 3 6 9
[1] 4 8 12
[,1] [,2] [,3] [,4]
[1,] 1 2 3 4
[2,] 2 4 6 8
[3,] 3 6 9 12
Can anyone please explain why and help me with it????