[R] identify data points by certain criteria

David Winsemius dwinsemius at comcast.net
Thu Jun 13 03:20:10 CEST 2013


On Jun 12, 2013, at 5:55 PM, Ye Lin wrote:

> Hey I want to identify data points by criteria, here is an example of my
> 1min data
> 
> Time     Var1      Var2
> 00:00    1              0
> 00:01    0              0
> 00:02    1              0
> 00:03    1              0
> 00:04    0              0
> 00:05    1              0
> 00:06    1              0
> 00:07    1              0
> 00:08    1              0
> 00:09    0              0
> 00:10    1              0
> 00:11    1              0
> 00:12    1              0
> 00:13    0              0
> 
> I want to identify the data points where Var1=0 and Var2=0, ( in this
> example shud be the points highlighted above), then calculate the time
> duration between these data points, (in this example, shud be 3min, 5 min
> and 4min), then identify the starting point of the max time duration ( in
> this example shud be the starting point of 5-min-duration, return the data
> points at 00:09), finally return the value in "Time" column ( in this
> example shud be "00:09")
> 

While you are waiting for an answer you might want to read the Posting Guide:

http://www.R-project.org/posting-guide.html

Points to pay special attention to: Plain-text. Posting code. Posting examples in form that can be pasted into console session (dump or dput functions). Providing context for problem (such as describing the conventions for your time-scale)  and your background (since this looks like a homework exercise.)



> Thanks for your help!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________


David Winsemius
Alameda, CA, USA



More information about the R-help mailing list