I want to use mutate on each of two data frames in a list, adding a column z = 3
to the first and z = 4
to the second (and returning a list of two data frames).
dfs <- list(data.frame(x = 1), data.frame(y = 2))
mapply(dplyr::mutate, dfs, z = 3:4, SIMPLIFY = FALSE)
#> Error in lazyeval::lazy_dots(...): Promise has already been forced
What's going wrong for me, and how should I go about doing what I want to do?
You could also do this with
map2
from thepurrr
package if you want to stay in thetidyverse
:You can also pipe the list into
map2
: