i_mean_grp {COINr} | R Documentation |
Replaces NA
s in a numeric vector with the grouped arithmetic means of the non-NA
values.
Groups are defined by the f
argument.
i_mean_grp(x, f, skip_f_na = TRUE)
x |
A numeric vector |
f |
A grouping variable, of the same length of |
skip_f_na |
If |
A numeric vector
x <- c(NA, runif(10), NA)
f <- c(rep("a", 6), rep("b", 6))
i_mean_grp(x, f)