Dear R-Helpers,

I have the following data set(y):

  Test_Result   #_Test
    t                 10
    f                 14
    f                 25
    f                 NA
    f                 40
    t                45
    t                44
 <NA>           47
    t                NA


I want to replace the NA values with the following method:
- for the numeric variable, replace NA with median
- for character variable , replace NA with the most frequent level

If i use x<-na.roughfix(y) the NA values are correctly replaced.
But if i x<-na.roughfix(y$Test_Result) i obtain the following error:

roughfix can only deal with numeric data.

How can i solve this proble that i met every time i want to replace only the
NA values of a column (type character)?

Thank you in advance.


Sergio Della Franca

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to