Hi, I have a time series problem that I would like some help with if you have the time. I have many data from many sites that look like this:
Site.1 date time level temp 2009/10/01 00:01:52.0 2.8797 18.401 2009/10/01 00:16:52.0 2.8769 18.382 2009/10/01 00:31:52.0 2.8708 18.309 2009/10/01 00:46:52.0 2.8728 18.285 2009/10/01 01:01:52.0 2.8716 18.245 2009/10/01 01:16:52.0 2.8710 18.190 Site.2 date time level temp 2009/10/01 00:11:06.0 2.9507 18.673 2009/10/01 00:26:06.0 2.9473 18.630 2009/10/01 00:41:06.0 2.9470 18.593 2009/10/01 00:56:06.0 2.9471 18.562 2009/10/01 01:11:06.0 2.9451 18.518 2009/10/01 01:26:06.0 2.9471 18.480 As you can see, the times do not match up. What I would like to do is be able to merge these two data sets to the nearest time stamp by creating a new time between the two; something like this: date new.time level.1 temp.1 level.2 temp.2 2009/10/01 00:01:52.0 2.8797 18.401 NA NA 2009/10/01 00:13:59.0 2.8769 18.382 2.9507 18.673 2009/10/01 00:28:59.0 2.8708 18.309 2.9473 18.630 2009/10/01 00:43:59.0 2.8728 18.285 2.9470 18.593 2009/10/01 00:59:59.0 2.8716 18.245 2.9471 18.562 2009/10/01 01:13:59.0 2.8710 18.190 2.9451 18.518 2009/10/01 01:26:06.0 NA NA 2.9471 18.480 Note that the sites may not match in the # of observations and a return of NA would be necessary, but a deletion of that time point all together for both sites would be preferred. A possibly easier alternative would be a way to assign generic times for each observation according to the time interval, so that the 1st observation for each day would have a time = 00:00:00 and each consecutive one would be 15 minutes later. Thanks for any suggestions. Brad -- View this message in context: http://n4.nabble.com/time-series-problem-time-points-don-t-match-tp1748387p1748387.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.