[R] TRUE FALSE issue
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Wed Aug 11 04:20:49 CEST 2010
> with(a, Samples[apply(a[,-1], 1, any)])
[1] S2 S4
Levels: S1 S2 S3 S4 S5
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Alexander Eggel
Sent: Wednesday, 11 August 2010 12:05 PM
To: r-help at r-project.org
Subject: [R] TRUE FALSE issue
How can I extract the samples (S1-S5) containing a TRUE value in their row?
Solution should apply to a much bigger data frame.
> a
Samples A B C D . . .
1 S1 FALSE FALSE FALSE FALSE
2 S2 FALSE FALSE NA TRUE
3 S3 FALSE FALSE FALSE FALSE
4 S4 FALSE TRUE FALSE FALSE
5 S5 FALSE FALSE FALSE FALSE
.
.
.
Thank you guys, I appreciate your help a lot!
[[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.
More information about the R-help
mailing list