yeah, my mistake is that i did not make the data "c" into a zoo class.
now the problem solved.
thank you everybody

2009/11/27 Gabor Grothendieck <ggrothendi...@gmail.com>

> We will need a minimal reproducible example (as per last line on every
> message to r-help) to answer as trying it with made up data seems to
> work for me.   If c is very long try cutting it down to the smallest
> you can get it to and still produce the error, e.g.
>
> cc <- c[1:10]
> rollapply(cc, ...)
>
> and then post the output of dput(cc)
>
> Here is an example:
>
> > library(zoo)
> > c <- zoo(1:100)
> > rollapply(c, 10, sd, na.pad = TRUE, align = 'right')
>        1        2        3        4        5        6
>      NA       NA       NA       NA       NA       NA
>       7        8        9       10       11       12
>      NA       NA       NA 3.027650 3.027650 3.027650
>      13       14       15       16       17       18
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      19       20       21       22       23       24
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      25       26       27       28       29       30
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      31       32       33       34       35       36
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      37       38       39       40       41       42
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      43       44       45       46       47       48
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      49       50       51       52       53       54
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      55       56       57       58       59       60
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      61       62       63       64       65       66
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      67       68       69       70       71       72
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      73       74       75       76       77       78
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      79       80       81       82       83       84
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      85       86       87       88       89       90
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      91       92       93       94       95       96
> 3.027650 3.027650 3.027650 3.027650 3.027650 3.027650
>      97       98       99      100
> 3.027650 3.027650 3.027650 3.027650
> > R.version.string
> [1] "R version 2.10.0 Patched (2009-11-21 r50532)"
> > packageDescription("zoo")$Version
> [1] "1.6-2"
>
>
> On Fri, Nov 27, 2009 at 2:19 AM, Saji Ren <saji....@gmail.com> wrote:
> > Hello:
> >
> > I want to get a rolling estimation of the stdev of my data.
> > Searching the document, I found the function "rollapply" in the zoo
> package.
> >
> > For example, my series is "c", and i want get a period of 10 days,
> > so i write the command below:
> >
> > roll.sd = rollapply( c, 10, sd, na.pad = TRUE, align = 'right' )
> >
> > but there is an error in it ,and the computing cannot be performed.
> > Can anyone help?
> >
> > PLUS: I also found that there is a function called "rollFun" in package
> > 'fSeries', but there isn't anymore.
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to