On Tue, Nov 23, 2010 at 3:58 PM, Manta <mantin...@libero.it> wrote: > > Ok this helps definitely! But I still would like to know > > 1. How to change from one index to another within a 'zoo' object
Using z <- zooreg(1:10, start = as.yearmon("2000-01"), freq = 12) Try aggregate(z, as.Date, identity) or time(z) <- as.Date(time(z)) Note that an example of the first approach was already shown in the earlier answer. > 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: aggregate(z, as.yearmon, function(x) tail(x, 1)) Suggest you carefully review ?aggregate.zoo -- 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.