hadley wickham schrieb:
Hi Stefan,

Could you be a bit more explicit?  Do you have an example dataset that
you are trying to visualise?


Right, thanks for pointing out the obvious.

So here's my code:

>>
library(gplots)

quarter <- as.factor(sample(c("Q1", "Q2", "Q3", "Q4"),
        100, replace = TRUE))
year <- as.factor(sample(c(seq(from=2000, to=2008)), 100, replace = TRUE))
category <- as.factor(sample(c(seq(from=1, to=4)), 100, replace = TRUE))
test <- data.frame(quarter, year, category)
table(test$category, test$quarter, test$year)
barplot2(table(test$quarter, test$year),
    beside=T, ylim=c(0,10), main="how to include dim3?")
# inclusion of 3rd dimension does not work:
barplot2(table(test$quarter, test$year, test$category),
    beside=T, ylim=c(0,10), main="how to include dim3?")
<<

I want the barplot to be exactly the same but with the bars stacked (by 'category'). I got the message from Gaspar, but have not yet tried to fit his example to my data.

/Stefan

______________________________________________
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.

Reply via email to