[R] Plot means with error bars - A novice needs help

Manuel Morales Manuel.A.Morales at williams.edu
Wed Oct 8 21:28:48 CEST 2008


On Wed, 2008-10-08 at 12:01 -0500, 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.

Actually, the functions in sciplot will do this for you. All you need is
to specify a response column, the column indicating the x-axis, the
dataframe, and the subset of interest.

E.g.:

bargraph.CI(response=whatever.column.has.the.response, x.factor=col10,
data=data, subset=col2==2)

The default is to plot the mean +/- 1SE but this can be changed as
needed.

HTH,

Manuel

> I know this is probably as clear as mud, thanks for you continuing patience.
> I would really appreciate any assistance you are able to provide me. My
> limited knowledge in R grows quite rapdily and things become so much more
> successful for me when I am granted tips and snippets of code form R users
> like you.
> 
> Sincerely,
> Michael Just
> 
> On Wed, Oct 8, 2008 at 11:25 AM, hadley wickham <h.wickham at gmail.com> wrote:
> 
> > 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/
> >
> 
> 	[[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/1e43b245/attachment.bin>


More information about the R-help mailing list