[Solved] Replace values greater than zero with 1 in r
[ad_1] The following will convert all non-zero numeric values to 1: df.richness %>% mutate_if(is.numeric, ~1 * (. != 0)) while df.richness %>% mutate_if(is.numeric, ~1 * (. > 0)) will do that with those greater than zero. [ad_2] solved Replace values greater than zero with 1 in r