I know this is the sort of question that is hated in any forum, but I have tried my best: I could not get rid of the error below, so I ended up taking the suggested steps for this issue, de- and reinstalled R and all packages, and it worked! For a short time - now, after having restarted my computer, I receive the same familiar error from a function that I do not directly call and which I find hard to trace ("p"?). As far as I know, the functions I call are not deprecated - it did end up working after cleaning my computer of everything related to R. In addition to de-/reinstalling R, is there a good tip of how to deal with such an issue? Is there a particular information from my system that could help trace this error?
This is my rather simple code which is supposed to set NA's to the maximum value in each pid-group:
require("tidyverse")
list_na <- c("val1","val2")
dftest <- data.frame(pid=c(rep(1,5),rep(0,5)),
val1=c(NA,1,1,1,3,NA,NA,3,1,NA),
val2=c(NA,1,1,1,3,NA,NA,3,-100,NA))
dftest <- dftest %>% group_by(pid) %>%
mutate(across(any_of(list_na), ~replace_na(.x, max(.x, na.rm = T))))
dftest
Error message:
Error in `mutate()`:
! Problem while computing `..1 = across(any_of(list_na), ~replace_na(.x,
max(.x, na.rm = TRUE)))`. Caused by error in `across()`:
! Problem while computing column `val1`. Caused by error in `p()`:
! could not find function "p"
I have no idea what p() refers to.