How to compute conditional Mode in R?
I have a large data set with 11 columns and 100000 rows (for example) in which i have values 1,2,3,4. Where 4 is a missing value. What i need is to compute the Mode. I am using following data and function ac<-matrix(c("4","4","4","4","4","4","4","3","3","4","4"), nrow=1, ncol=11) m<-as.matrix(apply(ac, 1, Mode)) if i use the above command then it will give me "4" as the Mode, which i do not need. I want that the Mode will omit 4 and display "3" as Mode, because 4 is a missing value. Thanks in advance. R has a powerful mechanism to work with missing values. You can represent a missing value