[R] reshaping of data for barplot2

Jean-Louis Abitbol abitbol at sent.com
Wed Nov 24 19:24:57 CET 2004


Dear All,

I have  the following data coming out from 

s <- with(final,
           summarize(norm, llist(gtt,fdiab),
                     function(norm) {
                      n <- sum(!is.na(norm))
                      s <- sum(norm, na.rm=T)
                      binconf(s, n)
                     }, type='matrix')
)
ie 

     gtt fdiab   norm.norm  norm.norm2  norm.norm3
18    PL    No  3.70370370  0.18997516 18.28346593
19    PL   Yes  3.57142857  0.18319034 17.71219774
13    TT1   No  9.09090909  3.59221932 21.15923917
14    TT1  Yes  1.81818182  0.09326054  9.60577606
...
10  HIGH    No 26.53061224 16.21128213 40.26228897
11  HIGH   Yes 10.00000000  4.66428345 20.14946472

I would like to reshape the data so that I can barplot2 treatments (gtt)
with 2 beside bars for fdiab  yes/no and add CI.

Various attemps have been unsuccessful as I have not understood both the
logic of beside and the nature of structures to be passed to barplot2.
Not enough know-how with reshape and transpose either.

Needless to say Dotplot works great with this kind of data but some
"Authority" requests side:side bars with CI.

Thanks for any help.

JL




More information about the R-help mailing list