On Tue, Nov 23, 2010 at 4:41 PM, Manta <mantin...@libero.it> wrote:
>
>
> Gabor Grothendieck wrote:
>>
>>> 2. How to import using as index 'Date' a monthly series (code below). The
>>> series in the US CPI from November 1979 to October 2010.
>>>
>>> z <- zoo(cpius$Value, as.Date("1979-11-30")+0:372)
>>
>> Assuming the question is how to turn this daily series into a monthly
>> series:
>>
>>
>
> No, I have a monthly series and I want to create a zoo object indexed by
> date and not by class yearmon or by a number (i.e., I would like to avoid
> this two structures when importing monthly data and to have as index the
> class date)
>
>> z=zooreg(cpius$Value,as.yearmon("1978-11"),frequency=12)
>> str(z)
> ‘zooreg’ series from Nov 1978 to Oct 2009
>  Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1 82 82 82.6 ...
>  Index: Class 'yearmon'  num [1:372] 1979 1979 1979 1979 1979 ...
>  Frequency: 12
>> z=zooreg(cpius$Value,start=c(1978,11),frequency=12)
>> str(z)
> ‘zooreg’ series from 1978.83333333333 to 2009.75
>  Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1 82 82 82.6 ...
>  Index:  num [1:372] 1979 1979 1979 1979 1979 ...
>  Frequency: 12

How to convert a monthly series to a daily series has already been
illustrated in multiple ways in this thread.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
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