How can I repeat a data frame with varying date column at the end? If I apply one of the previously recommended ways, all the columns get repeated. For example:
df<-data.frame(x1=c(1:3), x2=c('z','g','h'), x3=c( rep( as.Date("2011-07-31"), by=1, len=3)) )
n=2
do.call("rbind", replicate(n, df, simplify = FALSE))
x1 x2 x3
1 1 z 2011-07-31
2 2 g 2011-07-31
3 3 h 2011-07-31
4 1 z 2011-07-31
5 2 g 2011-07-31
6 3 h 2011-07-31
Whereas what I need is:
x1 x2 x3
1 1 z 2011-07-31
2 2 g 2011-07-31
3 3 h 2011-07-31
4 1 z 2011-08-01
5 2 g 2011-08-01
6 3 h 2011-08-01