Hello Petr, Thank you. That works beautifully. I searched for a way to transpose a data frame, but you are right: barplot() wants a matrix.
Andrew On Wed, Mar 4, 2009 at 1:49 AM, Petr PIKAL <petr.pi...@precheza.cz> wrote: > Read what barplot does and look to your plot. > > If you want each row to be plotted as stacked bar with names uder each bar > taken from peaople variable then you need to > > transpose your matrix - barplot takes columns > plot without names - you do not want them really plotted > add names under each bar - that is what names.arg is for > > barplot(t(data.matrix(fakedata[,-1])), names.arg=fakedata$people) > > Regards > Petr > > r-help-boun...@r-project.org napsal dne 03.03.2009 19:00:12: > >> What is the best way to produce a barplot from my data? I would like >> the barplot to show each person with the values stacked >> val1+val2+val3, so there is one bar for each person When I use >> barplot(data.matrix(realdata)), it shows one bar for each value >> instead. ______________________________________________ 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.