嗨,我有一个小的不连续时间序列数据(mWL):
> print(mWL)
dt Q1 Q2 R1 R2 S1 S2 S3 N1 N2 O
1 2013-05-25 12:00:00 NA NA NA NA NA NA NA NA NA NA
2 2013-05-25 13:20:00 NA NA NA NA NA NA NA NA NA NA
3 2013-05-25 15:20:00 NA NA 4.107 4.167 NA NA NA NA NA NA
4 2013-05-25 15:40:00 5.833 6.405 NA NA NA NA NA NA NA NA
5 2013-05-25 17:00:00 NA NA NA NA NA NA NA NA NA 6.957
6 2013-05-25 17:20:00 NA NA NA NA NA NA NA 6.088 7.307 NA
而且我还有一个相当大的连续(每 20 分钟)数据库(H),其中还包含一些“mWL”的时间测量
tail(H,n=80)
time e1
13782 2013-05-25 09:40:00 12.8452
13783 2013-05-25 10:00:00 12.8429
13784 2013-05-25 10:20:00 12.8376
13785 2013-05-25 10:40:00 12.8362
13786 2013-05-25 11:00:00 12.8338
13787 2013-05-25 11:20:00 12.8359
13788 2013-05-25 11:40:00 12.8371
13789 2013-05-25 12:00:00 12.8380
13790 2013-05-25 12:20:00 12.8355
13791 2013-05-25 12:40:00 12.8380
13792 2013-05-25 13:00:00 12.8396
13793 2013-05-25 13:20:00 12.8418
13794 2013-05-25 13:40:00 12.8403
13795 2013-05-25 14:00:00 12.8427
13796 2013-05-25 14:20:00 12.8443
13797 2013-05-25 14:40:00 12.8453
13798 2013-05-25 15:00:00 12.8460
13799 2013-05-25 15:20:00 12.8483
13800 2013-05-25 15:40:00 12.8508
13801 2013-05-25 16:00:00 12.8528
13802 2013-05-25 16:20:00 12.8547
13803 2013-05-25 16:40:00 12.8559
13804 2013-05-25 17:00:00 12.8579
13805 2013-05-25 17:20:00 12.8594
13806 2013-05-25 17:40:00 12.8613
我想制作一个“mWL”大小的新数据框(即只有6行),同时合并H$e1数据;但是当我尝试使用 align.time 时,数据框仍然很大并且“mWL”数据重复!
require(xts)
Hsort<-align.time(xts(H[,2],as.POSIXct(H[,1])), n=1200)
mWLsort<-align.time(xts(mWL[,2],as.POSIXct(mWL[,1])), n=1200)
merge(H, mWLsort)
有什么建议吗??