(apologies in advance for the stupid line-wrapping that I expect my email software to force upon us)
If I understand correctly what you want, I would (1) in both data frames, combine date and time into a single column (variable) that is class POSIXct (2) use the merge() function This assumes that your every-6-minutes data frame does NOT have a column with the same name as the observations in the every-second data frame. In fact, it would be best if the only column name they have in common is the date-time column. Your question is a little puzzling because your example data is not one obs per second, nor is it one per every 6 minutes. This may help: as.POSIXct('01/12/2012 03:14:55', format='%m/%d/%Y %H:%M:%S') or perhaps mydat$dt <- as.POSIXct( paste(mydat$date,mydat$time) , format='%m/%d/%Y %H:%M:%S') (supposing that your data frame is named mydat, and it has columns named 'date' and 'time' that look like those in your example.) -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 2/9/12 1:22 AM, "NickNz125" <nickthomas...@gmail.com> wrote: >PREFERED WAY OF DOING IT >I have a data set of observations every second for a month long period, I >want to extract the observations according to the date & time of another >data frame ( the other data frame is in the same format). I want to do >this >to match these observations to my test observations (in the other data >frame) which are done every 6 minutes. So basically im shrinking the data >frame of second observations to only display the date time observation >every >6 minutes. > >ALTERNATIVE WAY >In other words I just wanna extract every 6 minute observation value from >this dataframe of everysecond observations > >date time observations >02/08/2011 00:00 1.165 >02/08/2011 00:01 1.241 >02/08/2011 00:02 1.232 > > >Im pretty new to the porgram done 2 days on it learning and learning, im >getting my head around it. > >Help would be much appreciated. > >-- >View this message in context: >http://r.789695.n4.nabble.com/Subset-a-datafram-according-to-time-tp437229 >3p4372293.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >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. ______________________________________________ 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.