Replaces NA
s in a numeric vector with the grouped medians of the non-NA
values.
Groups are defined by the f
argument.
Arguments
- x
A numeric vector
- f
A grouping variable, of the same length of
x
, that specifies the group that each value ofx
belongs to. This will be coerced to a factor.- skip_f_na
If
TRUE
, will work around anyNA
s inf
(the corresponding values ofx
will be excluded from the imputation and returned unaltered). Else ifFALSE
, will cause an error.