[R] A problem on zoo object
Bogaso
bogaso.christofer at gmail.com
Fri Jul 3 11:26:26 CEST 2009
Thanks Gabor for this reply. However can please clarify one more thing? How I
want to create a list,
wherein each member of that list is the monthly observations. For example,
1st member of list contains daily observation of 1st month, 2nd member
contains daily observation of 2nd month etc.
Thanks
Gabor Grothendieck wrote:
>
> Try this:
>
> z <- zooreg(1:365, start = as.Date("2001-01-01"), freq = 1)
> f <- head
> tapply(seq_along(z), as.yearmon(time(z)), function(ix) f(z[ix]))
>
> where you should replace f with a function that does whatever
> you want with each month's data. Here we just used head as
> an example.
>
>
> On Wed, Jul 1, 2009 at 5:17 AM, Bogaso<bogaso.christofer at gmail.com> wrote:
>>
>> I have a zoo object on daily data for 10 years. Now I want to create a
>> list,
>> wherein each member of that list is the monthly observations. For
>> example,
>> 1st member of list contains daily observation of 1st month, 2nd member
>> contains daily observation of 2nd month etc.
>>
>> Then for a particular month, I want to divide all observations into 3
>> parts
>> (arbitrary) and then want to calculate some statistics on each part for
>> each
>> month. Therefore for a particular month, I will have 3 means (suppose,
>> statistic is mean).
>>
>> Can anyone throw some light on how to do that?
>> --
>> View this message in context:
>> http://www.nabble.com/A-problem-on-zoo-object-tp24286720p24286720.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.
>
>
--
View this message in context: http://www.nabble.com/A-problem-on-zoo-object-tp24286720p24320183.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list