Skip to content

Array to xts/zoo

2 messages · ehxpieterse, Brian G. Peterson

#
Hi,

I have an array which holds the cumulative profit of a trading strategy over
time. I use raw data of class xts/zoo by using quantmod's
getSymbols("^DJI").

My question: How do I transform my array to a zoo/xts class, by also using
the date formatting in the raw data? The array shows the corresponding
profit/loss for each day of data downloaded. Both my array and the raw data
from getSymbols have the same number of elements.

Thanks in advance.
Eduard
#
ehxpieterse wrote:
may I suggest chapter 9 of  
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf

failing that, try cbind()

In the future, I suggest that when dealing with timeseries, keep *all* 
of your data conveniently indexed by time.

Cheers,

  - Brian