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

Frank E Harrell Jr f.harrell at vanderbilt.edu
Thu Oct 9 13:26:05 CEST 2008


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



More information about the R-help mailing list