mercredi 2 avril 2014

Removing "NA" values in R (for some reason na.omit and complete.cases only work on one variable...)


Vote count:

0




I have a dataset with eight variable, and need to remove the NA values in four of them. When I use na.omit and complete.cases, it only succeeds in removing the NA values from the first column; the rest are unaffected.


All the columns contain the same type of data (factor), except that first column, which is numeric. I'm guessing that's where the issue lies, but have not been able to work around it or find a solution.


Ex: new.data <- data[complete.cases(data),] #this removes those numerical NA values


I'm guessing I need to either convert the (1) numeric variable to factor, or the (3) factors to numeric data, but am unsure if this is correct or how to proceed.



asked 37 secs ago






Aucun commentaire:

Enregistrer un commentaire