Skip to content

problem with chart.TimeSeries()

3 messages · Eric Zivot, Brian G. Peterson, Gabor Grothendieck

#
On Thu, 2011-09-22 at 09:38 -0700, Eric Zivot wrote:
This works for me in R 2.13.1:

######

require(PerformanceAnalytics)
require(quantmod)

getSymbols('vfinx',from="2006-05-01",to="2011-05-30")

head(VFINX)

ReturnsSimple.z = Return.calculate( 
    prices= VFINX$VFINX.Adjusted ,
    method='simple'
)

chart.CumReturns(
    ReturnsSimple.z,
    wealth.index=TRUE,
    legend.loc='topleft',
    lwd=2,main='Growth of $1'
)

#######

Make sure you have the latest version of zoo/xts, there was some
ugliness lately in as.Date between zoo/xts and R-base.

Also, you'll note that my example uses the newer getSymbols rather than
get.hist.quote, and returns an xts object directly, avoiding one
conversion step, so skipping your time()->Date() index conversion
entirely.

Regards,

  - Brian
#
On Thu, Sep 22, 2011 at 12:38 PM, Eric Zivot <ezivot at u.washington.edu> wrote:
I am able to reproduce this bug using zoo 1.7-4.  Its now fixed this
in the development version so you can either use the development
version of zoo (svn version 897 or later) or else just add this
statement to the above code for now:

source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/yearmon.R?revision=897&root=zoo")