Error with Rollmean
On Fri, Sep 23, 2011 at 12:52 PM, John Kerpel <john.kerpel at gmail.com> wrote:
I'm getting the following error with rollmean from the zoo package:
rollmean(x,k=20,align='right')Error in `colnames<-`(`*tmp*`, value = "T") :
?attempt to set colnames on object with less than two dimensions x is originally a univariate timeSeries object that is coerced to zoo via as.zoo. ?I've used this before without incident. ?What am I doing wrong? ?I'm on Windows-7 64 bit, R 64-bit v2.13.1.
We can't really tell what is wrong unless you provide a reproducible example. The following is reproducible and seems to work ok:
library(timeSeries)
Loading required package: timeDate
library(zoo)
...snip...
data(MSFT)
MSFT.zoo <- as.zoo(MSFT)
MSFT.zoo.3 <- rollmean(MSFT.zoo, 3)
packageVersion("zoo")
[1] ?1.7.4?
packageVersion("timeSeries")
[1] ?2130.92?
R.version.string
[1] "R version 2.13.1 Patched (2011-09-02 r56895)"
win.version()
[1] "Windows Vista (build 6002) Service Pack 2" Try displaying the output of dput(x) or show how to reconstruct it from scratch in a reproducible fashion.
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com