[R] Creating zoo object on monthly time series

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 1 14:47:42 CEST 2008


On Sun, Jun 1, 2008 at 8:35 AM, Megh Dal <megh700004 at yahoo.com> wrote:
> Hi all,
>
> I have following monthly time series :
>
>> head(data1)
>      V1 V2      V3
> 1 Nov-80 NA 1007.44
> 2 Dec-80 NA  982.05
> 3 Jan-81 NA  994.25
> 4 Feb-81 NA  996.31
> 5 Mar-81 NA  939.91
> 6 Apr-81 NA  923.32

If the suggestion below does not work then try
dput(head(data1)) to display it in an unambiguous form that is
readily re-input into R.

>
> Now I want to convert it to a 'zoo' object. I wrote following syntax :
>
> ss = zoo(data1[,3], as.Date(data1[,1], format="%m/%y"))
>

See ?strptime and try "%b-%y"

> However I got following :
>> head(ss)
>   <NA>    <NA>    <NA>    <NA>    <NA>    <NA>
> 1007.44  982.05  994.25  996.31  939.91  923.32
>
>
> Can anyone please tell me what will be the correct syntax?
>
> Thanks
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list