How to 0 to a value near zero, such as 1e-10?

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.


df %>%
    across(where(is.numeric), ~ ifelse(abs(.x) < 1e-10, 1e-10, .x))
1 Like