[R] Order in barchart
Bliese, Paul D MAJ USAMH
paul.bliese at us.army.mil
Mon Feb 2 17:45:31 CET 2004
Sorry if this is a FAQ -- I checked the archives and help files, but was
stumped.
In the data T3 (provided below) the values are sorted from lowest to
highest.
> T3
10 7 19 13 5 3 15 18
2 24
2.650568 2.666237 2.731649 2.749221 2.777130 2.801124 2.804472 2.813891
2.838316 2.839654
36 20 25 32 26 12 14 29
23 6
2.843043 2.868335 2.882906 2.896539 2.922535 2.931397 2.939590 2.944353
2.983473 3.015235
39 4 17 9 30 21 33 22
8 35
3.017590 3.020495 3.038758 3.066808 3.084511 3.086072 3.106873 3.127783
3.167053 3.173310
28 16 37 1 31 40 27 11
34 38
3.173323 3.221106 3.236643 3.274417 3.274772 3.283696 3.307872 3.355327
3.382744 3.498301
If I use barchart in the trellis library, the bars are arranged by factor
order of the labels (1,10,11,12,etc.).
> barchart(T3,xlab="Mean Values",col="dark blue")
Would it be possible to have the bars arranged from highest to lowest in
terms of the values (2.65, 2.66, 2.73, etc.) as it is done in barplot?
>barplot(T3,xlab="Mean Values",col="dark blue",horiz=T,cex.names=.5)
I would like to use barchart instead of barplot because of some of the
additional features of the lattice library.
Thanks,
Paul
More information about the R-help
mailing list