Re: [R] Finding minimum of time subset

2009-08-14 Thread Tim Clark
, Henrique Dallazuanna wrote: > From: Henrique Dallazuanna > Subject: Re: [R] Finding minimum of time subset > To: "Tim Clark" > Cc: r-help@r-project.org > Date: Friday, August 14, 2009, 7:19 AM > Try this also: > > times <- as.POSIXlt(mytime, format = &g

Re: [R] Finding minimum of time subset

2009-08-14 Thread Tim Clark
Jim, Got it! Thanks for the explanation and the example. Always nice to learn new tricks on R. Aloha, Tim Tim Clark Department of Zoology University of Hawaii --- On Fri, 8/14/09, jim holtman wrote: > From: jim holtman > Subject: Re: [R] Finding minimum of time subset >

Re: [R] Finding minimum of time subset

2009-08-14 Thread jim holtman
> does. > > Thanks for you help, > > Tim > > > > Tim Clark > Department of Zoology > University of Hawaii > > > --- On Fri, 8/14/09, jim holtman wrote: > >> From: jim holtman >> Subject: Re: [R] Finding minimum of time subset >> To: &

Re: [R] Finding minimum of time subset

2009-08-14 Thread Gabor Grothendieck
Converting to "times" class we can use trunc.times to truncate to 15 minutes and then use tapply to get the indices, ix. > library(chron) > tc <- times(mytime) > ix <- tapply(seq_along(tc), trunc(tc, "00:15:00"), head, 1) > tc[ix] [1] 12:00:00 12:15:05 12:30:01 12:45:01 13:00:00 13:15:02 Note tha

Re: [R] Finding minimum of time subset

2009-08-14 Thread Tim Clark
ontex, or what the number one at the end does. Thanks for you help, Tim Tim Clark Department of Zoology University of Hawaii --- On Fri, 8/14/09, jim holtman wrote: > From: jim holtman > Subject: Re: [R] Finding minimum of time subset > To: "Tim Clark" > Cc: r-help@r

Re: [R] Finding minimum of time subset

2009-08-14 Thread Henrique Dallazuanna
Try this also: times <- as.POSIXlt(mytime, format = "%H:%M:%S") subTimes <- times[times[['min']] %in% c(0,15,30,45)] format(subTimes[!duplicated(format(subTimes, "%H:%M"))], "%H:%M:%S") On Thu, Aug 13, 2009 at 5:10 PM, Tim Clark wrote: > Dear List, > > I have a data frame of data taken every fe

Re: [R] Finding minimum of time subset

2009-08-14 Thread jim holtman
Here is one way to do it: > mytime<-c("12:00:00","12:00:05","12:15:05","12:15:06","12:20:00","12:30:01","12:45:01","13:00:00","13:15:02") > # you might want a date on your data > x <- as.POSIXct(mytime, format="%H:%M:%S") > # create quarter hour intervals for the data range > quarter <- seq(trunc(

[R] Finding minimum of time subset

2009-08-13 Thread Tim Clark
Dear List, I have a data frame of data taken every few seconds. I would like to subset the data to retain only the data taken on the quarter hour, and as close to the quarter hour as possible. So far I have figured out how to subset the data to the quarter hour, but not how to keep only the m