replace value for NA in dplyr code example
Example 1: r na if
dat <- dat %>% mutate(x = replace(x, x<0, NA))
Example 2: repalce na with mean per group
impute_lm(df, rating ~ 1 | id)
dat <- dat %>% mutate(x = replace(x, x<0, NA))
impute_lm(df, rating ~ 1 | id)