[R] Number of NA's in every second column

From: Lauri Nikkinen <lauri.nikkinen_at_iki.fi>
Date: Sun, 20 May 2007 21:29:44 +0300


Hi R-users,

How do I calculate a number of NA's in a row of every second column in my data frame?

As a starting point:
dfr <- data.frame(sapply(x, function(x) sample(0:x, 6, replace = TRUE))) dfr[dfr==0] <- NA

So, I would like to count the number of NA in row one, two, three etc. of columns X1, X3, X5 etc.

Thanks in advance
Lauri

        [[alternative HTML version deleted]]



R-help_at_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. Received on Sun 20 May 2007 - 18:37:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 May 2007 - 20:33:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.