[R] strange use of sapply

From: <markleeds_at_verizon.net>
Date: Wed 21 Jun 2006 - 06:23:14 EST

I've tried and give up. I have a matrix of say 200 columns and 400 rows.

For each odd ( or even i suppose if i wanted to )column, I want to know the number of rows in which the value is greater than zero.

So, I did sapply(tempMatrix,2,function(x) sum( x > 0 ))

this almost works but i don't know how to tell it to only do the odd columns. my guess is , like everything else in R, this is possible. Thanks.

R-help@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 Received on Wed Jun 21 06:27:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 21 Jun 2006 - 08:13:45 EST.

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