Unfortunately non-standard evaluation makes it difficult to specify the column indirectly.
For example, what if you have the column name specified in a variable?
This is exactly what is going to happen if you allow users to select traits in your Shiny app.
input <- list(trait="Sepal.Length")
input$trait
## [1] "Sepal.Length"
Since input\(trait contains "Sepal.Length" we would hope that R would substute "Sepal.Length" for `input\)trait`
iris %>% ggplot(aes(x= input$trait)) + geom_histogram()
## Error: StatBin requires a continuous x variable: the x variable is discrete.Perhaps you want stat="count"?
aes() Looks for a column called “input$trait” or takes the text inside (“Sepal.Length”) literally and does not know to look for a column named “Sepal.Length”.