[R] Plot two zoo object with different indexes

Manta mantino84 at libero.it
Tue Nov 23 22:41:16 CET 2010



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 
-- 
View this message in context: http://r.789695.n4.nabble.com/Plot-two-zoo-object-with-different-indexes-tp3055890p3056295.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list