I'm playing around with some of the purrr functions and discoverd (to my delight) purrr::at_depth(.x, .depth, .f, ...) which is short for purrr::map(x, . %>% map(fun)).
Question: Is there a similar function or a proper "purrr-way" of doing the same thing when I have two nested lists that I want to iterate over in parallel
As an example:
x <- list(list(10, 20), list(30, 40))
y <- list(list(1, 2), list(3, 4))
a <- list()
for(i in seq_along(x)) {
a[[i]] <- map2(x[[i]], y[[i]], `+`)
}
This works but its rather dirty and I'd like to avoid the for loop.