Skip to content
Prev 69705 / 398526 Next

problem with as.timeSeries()

The matrix I want to convert to timeSeries object looks:

                       rp
2003-06-30 -1.0995685137
2003-07-01 -0.7065834677
2003-07-02  0.7661757181
  and so on...

In help it is stated that I should use as.timeSeries function like:

as.timeSeries(x, dimnames = TRUE, format = "")

So I try:
 > ts.rp = as.timeSeries(rp, dimnames=TRUE, format="%Y-%m-%d")
Error in "colnames<-"(`*tmp*`, value = character(0)) :
         attempt to set colnames on object with less than two dimensions

I don't exactly understand the error as:

 > dim(rp)
[1] 249   1

What am I doing wrong?

Best regards,
Wojtek