I have a data matrix like this:
> data[1:10,] aaname grp cluster count 1 Ala All Singleton 432 2 Arg All Singleton 1239 3 Asn All Singleton 396 4 Asp All Singleton 152 5 Cys All Singleton 206 6 Gln All Singleton 370 7 Glu All Singleton 211 8 Gly All Singleton 594 9 His All Singleton 213 10 Ile All Singleton 44 where the cluster column has three levels. > levels(data$cluster) [1] "Array" "Singleton" "rRNA" > Now, I would like to plot this like this: barchart(aaname~count|grp, group = cluster, data = data, stack = TRUE) I am thus using the cluster as the grouping. I would like to plot the relative abundance within each grouping, such that the max level in my plot always is one (or 100). This would for instance mean for the Ala in the All grp that the Singleton cluster consitute lets say 40% of the Ala in the All grp, wheras the Singleton and rRNA makes up 20% each. In this case I would get in my plot a Singleton stretching to 40%, whereas the other two would be 20% each, all in all making 100%. I am uncertain of whether I am managing to describe what I want, so I hope somebody understands what I want! Thanks! Karin -- Karin Lagesen, PhD student [EMAIL PROTECTED] http://folk.uio.no/karinlag ______________________________________________ R-help@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.