Using R, I want bars in a bar chart in a certain order.
The order is:
a<-c("no exercise", "strength", "moderate aerobics", "moderate aerobics + strength", "high aerobics")
And then the values, let's just say:
b<- c(10, 20, 25, 40, 40)
df<-data.frame(a, b)
When creating a bar plot, the order of bars is alphabetic, rather than the original:
ggplot(df) +
geom_bar( aes(x=a, y=b), stat="identity", fill="red")
[enter image description here][1] Is there a way to change that?
[1]: https://i.stack.imgur.com/sZDXc.png## Heading ##