Thanks David! I will pay attention to the format later. This is not homework exercise, I am just providing a mimic sample of my actual data and as I described in the original post, this is 1min data so the time interval is 1 min.
On Wed, Jun 12, 2013 at 6:20 PM, David Winsemius <dwinsem...@comcast.net>wrote: > > 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 > > [[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.