[R] count NAs with aggregate
Timo Stolz
timo.stolz at gerade-deshalb.org
Mon Mar 25 16:40:02 CET 2013
Dear members of this list,
I'd like to count missing values using the aggregate function.
Something like this:
count_nas <- function(arg1) {
return(sum(is.na(arg1)))
}
aggregate(cbind(var1, var2, var3) ~ subject + time, data = mydataset,
count_nas)
It's not working: I end up with a matrix containing zeros, although
there are missings in the data frame.
I'd highly appreciate a hint!
Thanks a lot,
Timo Stolz
More information about the R-help
mailing list