[R] Aggregating on date at Monthly Level

Shivi82 shivibhatia at ymail.com
Wed Jun 17 09:18:51 CEST 2015


HI All, 
I have situation where i am aggregating weight on monthly and quarterly
level.
I need to summarize weight on variable ship date i.e. shipping date . As
this date is in a character format so used the conversion as:

Shipdate<-as.Date("retail$ship.date", format="%m-%d-%Y"). But when i see the
output of Shipdate the result is NA. 
typeof(Shipdate) gives me "double". I am not sure what this is var type
whereas class (Shipdate) is Date so i am a bit puzzled. 

Then i have created a new var which sums weight and gives me the desired
result- 
aggr<-aggregate(retail$weight,list(retail$ship.date),mean)

Now if i want to group the result on a Month level i used the below syntax
and gives me error:
cut.Date(aggr,breaks = "Month",labels = TRUE). "x must be numeric"- in the
above syntax i have created it as a list.

Is there an easier way to achieve what i am looking for. Kindly suggest. 
Thanks, Shivi



--
View this message in context: http://r.789695.n4.nabble.com/Aggregating-on-date-at-Monthly-Level-tp4708741.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list