[R] Odp: aggregation question

Petr PIKAL petr.pikal at precheza.cz
Thu Jul 7 12:08:25 CEST 2011


Hi
> 
> Hi,
> 
> I am reading payment data like so
> 
> 2010-01-01,100.00
> 2010-01-04,100.00
> ...
> 2011-01-01,200.00
> 2011-01-07,100.00
> 
> and plot it aggregated per month like so
> 
> library(zoo)
> df <- read.csv("daily.csv", colClasses=c(d="Date",s="numeric"))
> z <- zoo(df$s, df$d)
> z.mo <- aggregate(z, as.yearmon, sum)
> barplot(z.mo, col="darkblue")
> 
> How do I get the monthly aggregated payments in different colors
> next to each other (ie for each year in a different color with the x
> axis showing the months)?

What about putting suitable set of colours to col argument?

Regards
Petr


> 
> Solution preferred, but pointers to documentation welcome :-)-O
> 
> greetings, el
> -- 
> Dr. Eberhard W. Lisse  \        / Obstetrician & Gynaecologist (Saar)
> el at lisse.NA el108-ARIN / *     |   Telephone: +264 81 124 6733 (cell)
> PO Box 8421             \     /   Please do NOT email to this address
> Bachbrecht, Namibia     ;____/        if it is DNS related in ANY way
> 
> ______________________________________________
> 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.



More information about the R-help mailing list