[R] how do I draw such a barplot?

Ido M. Tamir
Mon, 16 Jul 2007 07:51:02 -0000

Hi,

>Each row represents a single questionnaire with someone giving his
>agreement/disagreement with a statement (each column is a statement) that is
>coded from 1 to 5.

Maybe I mixed up columns and rows (because I find only
4 columns in you example) but it would go something like this with ggplot2:

library("reshape")
library("ggplot2")

my.data$id=1:nrow(my.data)
resp <- melt(my.data,id=5)
p <- ggplot(resp, aes(x=factor(variable), fill=factor(value))) +
geom_bar(position="fill")

http://had.co.nz/ggplot2/position_fill.html

best wishes
ido