[R] function to replace missing values with median value?

r user ruser2006 at yahoo.com
Wed May 3 19:06:40 CEST 2006


I have a data set with ~10 variables (i.e. columns).

I wrote this little function to replace missing values
with zero.  

“ sz <- function(x) { ifelse(is.na(x)==F,x,0) } “

Can anyone help with a function that replaces missing
values with the median of the non-missing values?




More information about the R-help mailing list