I like these questions about the lesser known purrr functions to see some real examples in action. modify_at and list_modify are both new to me. @cderv, I looked at your example with interest because of this. But when comparing answers I couldn't match the modify_at result with the map2 only approach.
Reprex using slightly more minimal test_tibble:
library(tidyverse)
test_tibble <- tibble(
par = list(
list(mean = 1, sd = 1),
list(rate = 3)),
adj = rep(2, 2))
test_tibble %>% glimpse()
#> Observations: 2
#> Variables: 2
#> $ par <list> [[1, 1], [3]]
#> $ adj <dbl> 2, 2
Using jim89's previous map2 only approach:
# using map2 only
test_tibble %>%
mutate(
par = map2(par, adj, function(list, adjustment) {
list[[1]] <- list[[1]] + adjustment
list
})) %>% glimpse()
#> Observations: 2
#> Variables: 2
#> $ par <list> [[3, 1], [5]]
#> $ adj <dbl> 2, 2
Existing modify_at answer is different (+2 added to both elements of test_tibble$par[[1]])
test_tibble %>%
mutate(par = modify_at(par, 1, ~ map2(.x, adj, `+`))) %>%
glimpse()
#> Observations: 2
#> Variables: 2
#> $ par <list> [[3, 3], [3]]
#> $ adj <dbl> 2, 2
Does the modify_at example needs rearranging slightly? Perhaps something like this?
test_tibble %>%
mutate(par = map2(par, adj, function(a, b) {
modify_at(a, 1, ~ .x + .y, b)
})) %>% glimpse()
#> Observations: 2
#> Variables: 2
#> $ par <list> [[3, 1], [5]]
#> $ adj <dbl> 2, 2
Created on 2018-05-02 by the reprex package (v0.2.0).