Skip to content
Prev 340300 / 398500 Next

help with xts

Using subset assignment with an array usually doesn't work well with
xts/zoo objects.  Your case wouldn't even work with a matrix because
you have NA in your array.

In this case, you can achieve the same result using multiplication:
pos.neg.1 <- ((cond1 < cond2)*-2+1)
test <- test * pos.neg.1

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
On Sun, May 18, 2014 at 9:25 AM, Pete <freerisk3 at gmail.com> wrote: