[R] TRUE FALSE issue

2010-08-10 Thread Alexander Eggel
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] Extract values from data frame in R

2010-08-09 Thread Alexander Eggel
Using R, I would like to find out which Samples (S1, S2, S3, S4, S5) fulfill
the following criteria:contain minimally one value (x, y or z) bigger than
4. Any ideas? Thanks, Alex.

 data
  Sample   xy  z
1S1   -0.35.32.5
2S20.40.2   -1.2
3S31.2   -0.63.2
4S44.30.75.7
5S52.44.32.3

[[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] Identification of Outliners and Extraction of Samples

2010-08-09 Thread Alexander Eggel
Hello everybody,

I need to know which samples (S1-S6) contain a value that is bigger than the
median + five standard deviations of the column he is in. This is just an
example. Command should be applied to a data frame wich is a lot bigger
(over 100 columns). Any solutions? Thank you very much for your help!!!

 s
Samples A BCE
1 S1   1 2 3 7
2 S2   4NA   6 6
3 S3   7 8 9NA
4 S4   4 5NA   6
5 S5   2 5 6 7
6 S6   2 3 4 5

This loop works fine for a column without NA values. However it doesn't work
for the other columns. I should have a loop that I could apply to all
columns ideally in one command.

o - data.frame();
for (i in 1:nrow(s))
{
   dd - s[i,];
   if (dd$A = median(s$A, na.rm=TRUE) + 5 * sd(s$A, na.rm=TRUE)) o -
rbind(o,dd)

}

[[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.