library(purrr)
library(dplyr)
df <- data.frame(a = c('a','b','c'), b = c(1,2,3))
df %>% walk2(.$a, .$b , function(a, b) print(c(a, b)) )
gives me an error Error: all(lengths == 1L | lengths == n) is not TRUE
However, the following prints successfully
df <- data.frame(a = c('a','b','c'), b = c(1,2,3))
walk2(df$a, df$b , function(a, b) print(c(a, b)) )
and even if I pass in all the arguments explicitly I get another error
df %>% walk2(.x = .$a, .y = .$b , .f = function(a, b) print(c(a, b)) )
Where the error is
Error in .f(1L, 1, list(a = 1:3, b = c(1, 2, 3))) :
unused argument (list(a = 1:3, b = c(1, 2, 3)))
Can anyone help me make sense of this?
I'm using purrr 0.24 and dplyr 0.7.4