I need to change my zero values in my dataframe to a value that is very close to zero (i.e., 1e-10). I tried the replace function but that didn't work. Does anyone know how to code that?
I might use Addition
Maybe you could do it like this.
library(dplyr)
df %>%
mutate(
across(where(is.numeric), ~ ifelse(abs(.x) < 1e-10, 1e-10, .x))
)
1 Like
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.