[R] problem with conditional column sums
JSHuang
js.huang at protective.com
Thu Jan 29 02:31:06 CET 2015
Hi,
I think you need quotation around I like the following:
> status
2010 2011 2012
1 A A A
2 A I I
3 A A A
4 U U U
5 A A A
6 I I I
7 U I I
8 A U A
9 I A U
10 I I I
> apply(start,2,function(x) {sum(x=="I",na.rm=TRUE)})
X2010 X2011 X2012
3 4 4
--
View this message in context: http://r.789695.n4.nabble.com/problem-with-conditional-column-sums-tp4702426p4702434.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list