I have number of columns in my dataset and I need to shift columns 18:101 down by one row. So far, I found this command in another thread to be helfpul and below I apply it to my data:
data.xts$AR2_Forecast <- transform(data.xts$AR2_Forecast, AR2_Forecast = c(NA, AR2_Forecast[-nrow(data.xts$AR2_Forecast)]))
However, since I have 83 additional columns, changing the names would be quite time-consuming. Is there anything I could use that would save me the time?
I was thinking of something along the lines of:
data.xts[18:101]<-
but I am not sure how the transform function should look. The class of my data is "xts", "zoo".
Thanks for any feedback!