set.seed(123)
gm <- gapminder::gapminder %>% mutate(pop = if_else(runif(n()) >= 0.9,NA_integer_,pop))
gm_nest <- gm %>% tidyr::nest(country_data = -continent)
gm_nest %>%
nest_replace_na(.nest_data = country_data,
replace = list(pop = -500))
Run the code above in your browser using DataLab