I find myself typing the following pattern very frequently when working with listcols:
my_tbl %>% mutate(listcol = map(listcol, some_function)) %>% mutate(listcol = map(listcol, some_other_function)) %>% mutate(listcol = map(listcol, ~ a_bit_different(.x)))
mutate(listcol = map(listcol, part of this pattern is a lot of typing. It would be great if there was a more concise way to perform these types of map-in-place mutations – something like:
my_tbl %>% mutmap(listcol, some_function) %>% mutmap(listcol, ~ some_other_function(.x))
Sometimes it's possible to work around this by
unnest()ing whatever is in
listcol, but a) listcol sometimes contains something other than a tibble/data frame, b) that requires extra lines of code to nest and unnest and c) clashing column names or different table dimensions in the values of
listcol can make this a pain.
Is there a function like this in purrr or elsewhere? Thanks!