Hello, I'd appreciate a suggestion on how to construct plots (barplots?) that use means on the Y axis instead of density/count. I'd also like to use groups and plot error or confidence interval bars on these graphs. I know this is a read the manual situation. I'd appreciate help with what to read, or your benevolence with some sample code. I've looked at lattice and gplots2, but given my beginner status my efforts are not propelling me very far. Thank you kindly, Michael Just [[alternative HTML version deleted]]
Dear Michael, take a look at plotmeans in gplots library. library(gplots) example(plotmeans) Hope this helps, Gianandrea Michael Just wrote:> > Hello, > I'd appreciate a suggestion on how to construct plots (barplots?) that use > means on the Y axis instead of density/count. I'd also like to use groups > and plot error or confidence interval bars on these graphs. I know this is > a > read the manual situation. I'd appreciate help with what to read, or your > benevolence with some sample code. > > I've looked at lattice and gplots2, but given my beginner status my > efforts > are not propelling me very far. > > Thank you kindly, > Michael Just > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. > >-- View this message in context: http://www.nabble.com/Plot-means-with-error-bars---A-novice-needs-help-tp19872142p19873501.html Sent from the R help mailing list archive at Nabble.com.
Michael Just wrote:> Hello, > I'd appreciate a suggestion on how to construct plots (barplots?) that use > means on the Y axis instead of density/count. I'd also like to use groups > and plot error or confidence interval bars on these graphs. I know this is a > read the manual situation. I'd appreciate help with what to read, or your > benevolence with some sample code. > > I've looked at lattice and gplots2, but given my beginner status my efforts > are not propelling me very far. >Hi Michael, Have a look at the barp function in the plotrix package. You can add error bars using the dispersion or dispbars function. Jim
Another option is bargraph.CI or lineplot.CI from the package sciplot. See http://mutualism.williams.edu/sciplot for examples. On Tue, 2008-10-07 at 23:31 -0500, Michael Just wrote:> Hello, > I'd appreciate a suggestion on how to construct plots (barplots?) that use > means on the Y axis instead of density/count. I'd also like to use groups > and plot error or confidence interval bars on these graphs. I know this is a > read the manual situation. I'd appreciate help with what to read, or your > benevolence with some sample code. > > I've looked at lattice and gplots2, but given my beginner status my efforts > are not propelling me very far. > > Thank you kindly, > Michael Just > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.-- http://mutualism.williams.edu -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081008/3bf0f446/attachment.bin>
On Tue, Oct 7, 2008 at 11:31 PM, Michael Just <mgjust at gmail.com> wrote:> Hello, > I'd appreciate a suggestion on how to construct plots (barplots?) that use > means on the Y axis instead of density/count. I'd also like to use groups > and plot error or confidence interval bars on these graphs. I know this is a > read the manual situation. I'd appreciate help with what to read, or your > benevolence with some sample code.Here's an alternative suggestion - don't use bars, use dots. Bar plots with standard errors are sometime called dynamite plots (probably because they should be blown up). See http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/DynamitePlots and http://emdbolker.wikidot.com/blog:dynamite for some reasons not to use them and possible alternatives. I hope that package authors who provide methods to make these plots easy will reconsider. Hadley -- http://had.co.nz/
Frank E Harrell Jr
2008-Oct-09 11:26 UTC
[R] Plot means with error bars - A novice needs help
Jim Lemon wrote:> Michael Just wrote: >> Thank you all for you suggestions. They are all helpful. However, I >> have come to a more fundamental problem. Preparing my data to even >> make such a graph. I thought I was ready. I will obviously need to >> find the n, mean, and confidence interval for my data before I can >> plot them. for some of these plots. >> >> I thought perhaps this data manipulation would be easily done in R, >> but perhaps I should do it elsewhere and then bring it into R. I have >> about 5000 rows & about 30 columns in my csv. I need to find: mean, n, >> confidence interval for a to-be-made selection from the entire data set. >> >> I have tried: aggregate, subset, dat$col1=2, etc >> >> Clearer?: I want to select data from my dataset where column1=2. Then >> when plotting this data I want to group it by 2 values (out of 4) from >> column10. >> > Hi Michael, > The describe function in the prettyR package might get the summaries you > want. I think you want to set num.desc=c("mean","std.error","valid.n"). > Combine describe with the "by" function to perform the subsetting, and > you should get what you want. > > Jim >Also see the book by Harrell and Alzola and many other documents linked from http://biostat.mc.vanderbilt.edu/RS -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University