I have a data frame as follows:
> head(train)
S D Date
1 1 1 2010-02-05
2 1 1 2010-02-12
3 1 1 2010-02-19
日期列每周只有一个日期,对于每个现有的日期,我想插入6行以填补之后缺失的所有日期。
所以最终结果应该如下:
> head(train)
S D Date
1 1 1 2010-02-05
1 1 1 2010-02-06 <- inserted
1 1 1 2010-02-07 <- inserted
1 1 1 2010-02-08 <- inserted
1 1 1 2010-02-09 <- inserted
1 1 1 2010-02-10 <- inserted
1 1 1 2010-02-11 <- inserted
2 1 1 2010-02-12
etc