I need to reorder the bars in my bar chart from highest to lowest. How do I do this? Thank you in advance!
Here is my coding:
advertisement <- ("A", "B", "C")
times_shown <- c(900, 1000, 800)
clicks <- c(140, 180, 105)
leads <- c(55, 54, 40)
advertisement_all <- data.frame(advertisement, times_shown, clicks, leads)
message=FALSE}
advertisement_all %>%
group_by(advertisement) %>%
summarise(clicks / times_shown, leads / clicks, leads / times_shown) %>%
ggplot(aes(x = times_shown, y = leads, fill = advertisement)) +
geom_col(position = "dodge") +
labs(title = "Flanders' Roofing Advertisements", subtitle =
"Leads v. Times Shown",
caption = "Analysis by B. P. Newton") +
xlab("Times Shown (#)") +
ylab("Leads (#)") +
scale_fill_discrete(name = "Advertisement", labels = c("A", "B", "C"))
And here is my graph. Variable "A" should be first, rather than in the middle, etc.