[R] Extract values from data frame in R
    Erik Iverson 
    eriki at ccbr.umn.edu
       
    Mon Aug  9 08:26:33 CEST 2010
    
    
  
On 08/09/2010 01:16 AM, Alexander Eggel wrote:
> 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       x        y      z
> 1        S1   -0.3    5.3    2.5
> 2        S2    0.4    0.2   -1.2
> 3        S3    1.2   -0.6    3.2
> 4        S4    4.3    0.7    5.7
> 5        S5    2.4    4.3    2.3
Untested:
Sample[apply(Sample[-1], 1, function(x) any(x) > 4)), "Sample"]
    
    
More information about the R-help
mailing list