Hi list, I have data in a dataframe t1, with a column for different amounts spent, a column what it was spent on, and a column with dates, from which I create a new column with months.
Example: amount <- rep(c(10,20,30),3) what <- rep(c("food","books","cycling"),3) when <- c(rep("2008-09-05",5),rep("2008-10-07",4)) t1 <- data.frame(amount,what,when) t1$when <- as.Date(t1$when) t1$month <- format(as.Date(t1$when),"%b") I want to have a barplot for each month, showing the sum spent in the different categories. I figured I can do this with traditional graphics using: barplot(xtabs(amount~what+month, data=t1),beside=T) But I'd like to be able to do this in lattice. I tried: barchart(amount~what|month,t1) But that doesn't sum the data for t1$amount for each month first. How could I do that? Thanks, Marianne -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber ______________________________________________ R-help@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.