I have a data table with date and price by month:
set.seed(128)
dat <- data.table(DATE=c(\"2014-01-01\",\"2014-02-01\",\"2014-03-01\",\"2014-04-01\",
The first term has no known price for previous month (I'm assuming - if it does, you can replace the NA with it).
The following code should work fine. The first line creates a new vector, the second adds it as a column to dat and the third removes the vector (as it's now in dat and we don't need it separately).
PRICE_PREV <- c(NA, dat$PRICE[1:length(dat$PRICE)-1])
dat <- cbind(dat, PRICE_PREV)
rm(PRICE_PREV)