Trying to get quantmod and the forecast package working together but having
some trouble with just the simple stuff. Any ideas on why this code doesn't
work ?

require(quantmod)
require(forecast)


getSymbols('^GSPC', from='1950-01-06', to=Sys.Date())
z <-to.monthly(GSPC)[,6]
names(z) <-"GSPC"

train <-z['::2009-01']
test <-z['2009-02::2012-01']

train.model <-rwf(train, drift=TRUE,h=1)
acc.train <-accuracy(train.model)
acc.test<-accuracy(train.model,test)

Seems to work all the way through the acc.train statement but then gets
hung up at acc.test. I get the following error:


Error in `[.xts`((c(xx[2:n])/c(xx[1:(n - 1)]) - 1), test - 1) :
  subscript out of bounds

	[[alternative HTML version deleted]]

