It works! Thanks! On May 15, 10:46 pm, Gabor Grothendieck <ggrothendi...@gmail.com> wrote: > Reorder it based on the negative of abundance to reverse it: > reorder(table$species, - table$abundance) > > > > On Sat, May 15, 2010 at 6:40 AM, Kang Min <ngokang...@gmail.com> wrote: > > Hi fellow R users, > > > I have a dataset that looks something like this. > > > species class abundance > > K 1 592 > > K 2 288 > > G 1 254 > > G 2 239 > > C 2 173 > > D 2 123 > > E 3 89 > > F 2 87 > > B 2 86 > > H 2 82 > > I 1 79 > > J 2 76 > > B 1 73 > > D 3 72 > > A 2 62 > > L 2 58 > > > I want to plot a stacked barchart. species is the x-axis, abundance is > > y-axis, and class will appear as the stacks in different colours. I > > need the species to be displayed in descending order of abundance, > > meaning species K on the left side of the graph to species L on the > > right. > > > I've read other posts here that recommended the function reorder, > > which I've used but species K appears on the right side of the graph > > instead. > > > barchart(table$abundance ~ reorder(table$species, table$abundance), > > groups = table$class, stack = T, scales = list(x = list(draw = > > F)), > > auto.key = list(adj = 1)) > > > Is there anything wrong with my code? > > > Thanks. > > Kang Min > > > ______________________________________________ > > r-h...@r-project.org mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- > You received this message because you are subscribed to the Google Groups > "R-help-archive" group. > To post to this group, send email to r-help-arch...@googlegroups.com. > To unsubscribe from this group, send email to > r-help-archive+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/r-help-archive?hl=en.
______________________________________________ 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.