Updated with sample data:
mydata <- read.table(header=TRUE, text="
Item Value Site
A 96 site1
B 1 site1
C 2 site1
A 1 site2
B 62 site2
A 19 site3
B 1 site3
C 11 site3
D 9 site3
")
What I'm trying to do is plot a stacked bar chart and reorder the item variable differently for each site, sorting it by the value column. So for each site, the item with the biggest percentage value is at the bottom of the stacked bar, followed by the next largest percentage value and so on. However, I've tried different methods and had difficulty arranging by the stacked bars using the value column.
Edit with solution: follow the link marked as the answer above, plot each bar individually using geom_bar and add in the reorder function - aes(fill=reorder(Item, +Value))