[R] aggregation question

Dr Eberhard Lisse el at lisse.NA
Thu Jul 7 11:41:17 CEST 2011


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)?

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



More information about the R-help mailing list