[R] Turnpoints

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Sep 16 19:51:17 CEST 2009


Hi,

On Sep 16, 2009, at 1:42 PM, ogbos okike wrote:

> Good evening to everybody. I have a data of four columns - three of  
> the
> columns represent date while the fourth is counts.  Setting 4000 as my
> minimum point/value, I wish to find out the number of counts that  
> are less
> or equal to 4000 and the dates they occur. I have installed pastecs  
> and have
> been trying to use turnpoints function to do this. I have not been  
> much
> lucky. I am a still learning. I have added part of my data here  
> where y
> stands for year, m month, d day and lastly the count.
> I would be grateful to anyone who could show me the way the do this.
> Best regards
> Ogbos
>
> y  m   d  count
> 93 02 07 3974.6
> 93 02 08 3976.7
> 93 02 09 3955.2
> 93 02 10 3955.0
> 93 02 11 3971.8
> 93 02 12 3972.8
> 93 02 13 3961.0
> 93 02 14 3972.8
> 93 02 15 4008.0
> 93 02 16 4004.2
> 93 02 17 3981.2
> 93 02 18 3996.8
> 93 02 19 4028.2
> 93 02 20 4029.5
> 93 02 21 3953.4
> 93 02 22 3857.3
> 93 02 23 3848.3
> 93 02 24 3869.8
> 93 02 25 3898.1
> 93 02 26 3920.5
> 93 02 27 3936.7
> 93 02 28 3931.9

Assume your data is stored in a variable called df
Look at what this gives you:

R> less4000 <- df$count < 4000

1. You can sum that vector to tell you how many rows have count less  
than 4000
2. You can use it to select out of the vector.

R> df[less4000,]

You can also use the subset function

R> subset(df, count < 4000)

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list