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

jeff.a.ryan at gmail.com jeff.a.ryan at gmail.com
Sun Mar 7 02:29:37 CET 2010


Sent via BlackBerry from T-Mobile

-----Original Message-----
From: jeff.a.ryan at gmail.com
Date: Sun, 7 Mar 2010 01:28:57 
To: Robert Nicholson<robert.nicholson at gmail.com>
Subject: Re: [R-SIG-Finance] Adding columns to an XTS

Hi Robert,

Try ?merge.xts

That will do what you want. 

Best,
Jeff
------Original Message------
From: Robert Nicholson
Sender: r-sig-finance-bounces at stat.math.ethz.ch
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-SIG-Finance] Adding columns to an XTS
Sent: Mar 6, 2010 7:06 PM

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?
_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.


Sent via BlackBerry from T-Mobile


More information about the R-SIG-Finance mailing list