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

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Mar 10 15:12:26 CET 2010


You already asked and received an answer for this question.  I also
answered you when you asked me this question off-list.  Please don't
post duplicate questions, especially when they were answered only days
ago!

As Jeff Ryan said, use merge.xts.  See ?merge.xts.

x <- .xts(1:10,1:10)
y <- merge(x,d=diff(x))

As I said, use "$<-".  See ?"$".
y$r <- rnorm(NROW(y))

Do some work.  No one is going to spoon feed you.

--
Joshua Ulrich
FOSS Trading: www.fosstrading.com



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.
>



More information about the R-SIG-Finance mailing list