[R-SIG-Finance] Most common way to add derived columns to an XTS object?

Jeff Ryan jeff.a.ryan at gmail.com
Wed Mar 10 15:08:51 CET 2010


Hi Robert,

New columns aren't attributes, they are columns.  For that:

> x <- xts(1:10, Sys.Date()+1:10)
> y <- x*2
> merge(x,y)
            x  y
2010-03-11  1  2
2010-03-12  2  4
2010-03-13  3  6
2010-03-14  4  8
2010-03-15  5 10
2010-03-16  6 12
2010-03-17  7 14
2010-03-18  8 16
2010-03-19  9 18
2010-03-20 10 20


HTH,
Jeff

On Wed, Mar 10, 2010 at 7:52 AM, Robert Nicholson
<robert.nicholson at gmail.com> wrote:
> So you have data in your XTS object and all I'm trying to do is add columns (attributes) that are derived values.
>
> does anybody have an example of this?
>
> I'm trying to perform a simply transformation on an existing attribute in my XTS object and store the value as a new attribute.
>
> _______________________________________________
> 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.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list