Re: [R] TRUE FALSE issue

2010-08-10 Thread Bill.Venables
For huge cases this might be a whiff faster

> with(a, Samples[rowSums(a[, -1], na.rm = TRUE) > 0])
[1] S2 S4
Levels: S1 S2 S3 S4 S5



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of bill.venab...@csiro.au
Sent: Wednesday, 11 August 2010 12:21 PM
To: egg...@gmx.net; r-help@r-project.org
Subject: [ExternalEmail] Re: [R] TRUE FALSE issue

> with(a, Samples[apply(a[,-1], 1, any)])
[1] S2 S4
Levels: S1 S2 S3 S4 S5 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Alexander Eggel
Sent: Wednesday, 11 August 2010 12:05 PM
To: r-help@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@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.

__
R-help@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.

__
R-help@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.


Re: [R] TRUE FALSE issue

2010-08-10 Thread Bill.Venables
> with(a, Samples[apply(a[,-1], 1, any)])
[1] S2 S4
Levels: S1 S2 S3 S4 S5 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Alexander Eggel
Sent: Wednesday, 11 August 2010 12:05 PM
To: r-help@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@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.

__
R-help@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.


Re: [R] TRUE FALSE issue

2010-08-10 Thread David Winsemius


On Aug 10, 2010, at 10:16 PM, Erik Iverson wrote:


On 08/10/2010 09:04 PM, Alexander Eggel wrote:
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
.


Please give us *reproducible* examples as the posting guide requests.

See ?rowSums


Or

?any
?apply






David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] TRUE FALSE issue

2010-08-10 Thread Erik Iverson

On 08/10/2010 09:04 PM, Alexander Eggel wrote:

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
.


Please give us *reproducible* examples as the posting guide requests.

See ?rowSums

__
R-help@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.