Skip to content
Back to formatted view

Raw Message

Message-ID: <322923.46672.qm@web28208.mail.ukl.yahoo.com>
Date: 2011-01-12T21:05:07Z
From: Jannis
Subject: aggredating date data
In-Reply-To: <1c0e0b99-5472-458b-92ab-285b98cec194@v17g2000vbo.googlegroups.com>

?aggregate

I would transfer your date character sting into a date object (as.POSIXct) and then extract month or week numbers (?format) from this vector and use them as indices for the aggregate function. There may be more elegant ways though....


HTH
Jannis

--- analyst41 at hotmail.com <analyst41 at hotmail.com> schrieb am Mi, 12.1.2011:

> Von: analyst41 at hotmail.com <analyst41 at hotmail.com>
> Betreff: [R] aggredating date data
> An: r-help at r-project.org
> Datum: Mittwoch, 12. Januar, 2011 20:20 Uhr
> I tried a date by date forecast of a
> time series and it seems to be
> too wild.? How can I aggregate the date into weeks or
> months as
> required?
> 
> Thanks.
> 
> The input looks like
> 
> ID datadate("YYYY-MM-DD")? value_for_day
> --? ???-----? ? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ? -------
> --? ???------? ? ?
> ? ? ? ? ? ? ? ?
> ? ? ? ???--------
> 
> and I want to be able to change it to
> 
> ID dataweek value_for_week
> 
> or
> 
> ID datamonth value_ for_ month
> 
> ______________________________________________
> 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.
>