I have a ggplot inside of a renderPlot function. This code block works as expected:
output$revenue_channel <- renderPlot({
ggplot(untrended_data(), aes(x = reorder(Channel, Revenue), y = Revenue), label = Revenue) +
geom_bar(stat="identity", fill = "#008080", alpha = 0.6) +
coord_flip() +
geom_text(aes(label = scales::dollar(Revenue)), hjust= 1.2, color = "white") +
scale_y_continuous(label = scales::label_dollar(scale = 0.001, suffix = "K")) +
xlab("") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
}, height = 300)
This code block as is runs and produces this chart:

But, in my I actually have a breakdown selector where the user ca enter one of Channel, Device or UserType.
So, this line:
ggplot(untrended_data(), aes(x = reorder(Channel, Revenue), y = Revenue), label = Revenue)
Would become either this:
ggplot(untrended_data(), aes(x = reorder(Device, Revenue), y = Revenue), label = Revenue)
Or this:
ggplot(untrended_data(), aes(x = reorder(UserType, Revenue), y = Revenue), label = Revenue)
I tried just switching in input$myinput like so
ggplot(untrended_data(), aes(x = reorder(input$breakdown, Revenue), y = Revenue), label = Revenue)
But this gives an error:
Error: arguments must have same length
I then tried aes_ for aes_string():
ggplot(untrended_data(), aes_(x = reorder(input$breakdown, "Revenue"), y = "Revenue"), label = Revenue)
Discrete value supplied to continuous scale
I then tried t make sense of this page on quasi-quotation and tried:
ggplot(untrended_data(), aes(x = reorder(!! input$breakdown, Revenue), y = Revenue), label = Revenue)
Which resulted in:
Error: arguments must have same length
How can I pass input$breakdown into ggplot within renderPlot({})?
reorder(!! rlang::sym(input$breakdown), Revenue),