[R] How to take ID of number > 7.

Berend Hasselman bhh at xs4all.nl
Sun Apr 22 14:59:01 CEST 2012


On 22-04-2012, at 13:03, Yellow wrote:

> I figured out something new that I would like to see if I can do this more
> easy with R then Excel. 
> 
> I have these huge files with data. 
> For example: 
> 
> DataFile.csv 
> ID Name log2 
> 1 Fantasy 5.651 
> 2 New 7.60518 
> 3 Finding 8.9532 
> 4 Looeka -0.248652 
> 5 Vani 0.3548 
> 
> With like header1: ID, header 2: Name, header 3: log2 
> 
> Now I need to get the $ID out who have a &log2 value higher then 7. 
> 
> I know ho to grab the $log2 values with 7+ numbers. 
> 
> Log2HigherSeven = DataFile$log2 [ DataFile$log2 >= 7]  
> 
How about

DataFile[DataFile$log2 >= 7, c("ID","Log2")]

to get a dataframe with two columns ID and log2.

Berend



More information about the R-help mailing list