[R] counts of each column that are not NA, and/or greater than column means

From: Ng Stanley <stanleyngkl_at_gmail.com>
Date: Mon, 4 Feb 2008 15:21:10 +0800


Given a test matrix, test <- matrix(c(1,2,3,NA,2,3,NA,NA,2), 3,3)

  1. How to compute the counts of each column (excluding the NA) i.e., 3, 2, 1
  2. How to compute the counts of each column (excluding the NA) that are greater than the column means ? i.e., 1, 1, 0

I could write a for loop, but hope to use better alternative.

        [[alternative HTML version deleted]]

R-help_at_r-project.org 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 Mon 04 Feb 2008 - 07:56:36 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 Mon 04 Feb 2008 - 09:30:11 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.

list of date sections of archive