[R] barplot (stacked)

K. Elo maillists at nic.fi
Wed Mar 24 13:32:03 CET 2010


Hi Jens!

23.03.2010 17:18, koj wrote:
> The problem is: I want to group the data. I want to have ten groups. The
> first two bars should be [1,1] and [2,1] together in one bar and in the
> second bar of the first obervation should be [1,2] and [2,2] (stacked with
> beside =TRUE). Therefore the first observation is [1,1],[1,2],[2,1] and
> [2,2].

I am not sure that I wholly understood what You want :) But why not use 
lattice 'barchart' instead:

Let's suppose 'dm' is your data matrix. Please try the following command 
and let us know, if the output is what you are looking for:

barchart(~dm[,1]+dm[,2], stacked=T)

HTH,
Kimmo



More information about the R-help mailing list