Hi everyone! I am trying to remove the missing values from a dataset loaded from SPSS with the package "foreign". The dataset appears as a list. I use the na.omit and na.exclude functions but they don't work. When I view the dataset I still see NAs, and the next command gives an error related to NA, so I suppose the missing values were not removed. Converting it to a data frame didn't help. Thank you!
Here is the code:
as.data.frame(COMET)
COMETgood<-na.omit(COMET)
COMETgood<-na.exclude(COMET)
And I get this error for the last line:
Error in quantile.default(y, probs = seq(0, 1, length = groups)) :
missing values and NaN's not allowed if 'na.rm' is FALSE
Sorry for taking me so long to reply! Thank you very much for the detailed answer!! I do not understand though why I have to add dummy variables with NA and NaN values. Yes, my SPSS data is a list