[R-SIG-Finance] Adding columns to an XTS

Robert Nicholson robert.nicholson at gmail.com
Sun Mar 7 02:06:05 CET 2010


If you're using rollapply with an existing XTS object from getSymbols what's the most appropriate way to add new columns to the object?

say you have

getSymbols('AAPL')
change = rollapply(Cl(AAPL),width=2, function(x) log(x[2]/x[1]), by=1, align = "right", na.pad = TRUE)
colnames(change) <- c('AAPL.change')

how can you get change into the original AAPL xts object whereby everything is lined up correctly?


More information about the R-SIG-Finance mailing list