Re: [R] Formating a zoo dataset .

2008-03-03 Thread Gabor Grothendieck
Your code below changes the class of the time index from "Date" to "character". Perhaps you want "yearmon" class. The following averages all values in each month producing a series with time class "yearmon". See ?yearmon library(zoo) z <- zoo(c(0.1423065, -0.03276228, -0.0652789, -0.04999873, -0

[R] Formating a zoo dataset .

2008-03-02 Thread Megh Dal
Suppose I have following dataset : > head(data1) Date Return 1 03/31/00 0.14230650 2 04/28/00 -0.03276228 3 05/31/00 -0.06527890 4 06/30/00 -0.04999873 5 07/31/00 -0.01447902 6 08/31/00 0.22265729 Now I convert it to zoo object : > data11 = zoo(data1[,2], as.Date(data1[,1],