I am trying to replace NA in a subset of columns and I want to use tidyverse/dplyr syntax. dplyr v1.0.2
In the following, I want only to replace the NAs with 999 in columns ab,ac but not in ads
tbf <- tibble( ab = c(1,3,NA), ac = c(23,NA,33), d = c(22,22,NA), ads = c('ds', NA, "dwe"))
tbf %>% mutate(across(starts_with('a') & where(is.numeric)), ~replace_na(999))
does not seem to work.
I tried ~replace_na(.x,999) too. That didn't work either.
Any help is appreciated.