| i_median_grp | R Documentation |
Replaces NAs in a numeric vector with the grouped medians of the non-NA values.
Groups are defined by the f argument.
i_median_grp(x, f)
x |
A numeric vector |
f |
A grouping variable, of the same length of |
A numeric vector
x <- c(NA, runif(10), NA)
f <- c(rep("a", 6), rep("b", 6))
i_median_grp(x, f)