I am using Shiny for the first time in R. I am using the following code to generate my app:
library(shiny)
library(ggplot2)
library(tidyverse)
feature.options <- c("UTR length", "total RBP", "Counts AREs", "Codon Optimality", "m6A enrichment")
ui <- fluidPage(
titlePanel("Feature distributions"),
theme = shinythemes::shinytheme("sandstone"),
sidebarLayout(
sidebarPanel(
selectInput("feature", "Which feature do you want to analyze?", choice = feature.options)
),
mainPanel(
plotOutput("plot")
)
)
)
server <- function(input, output, session) {
output$plot <- renderPlot({
Matrix.PV.mRNA.destab %>%
group_by(status) %>%
ggplot( aes(x = input$feature, fill = status)) +
geom_density(color = "black") +
theme_classic() +
theme(axis.text = element_text(size = 14),
axis.title = element_text(size = 14))
})
}
shinyApp(ui, server)
The result I get is this (The selectInput works out just fine, don't know why it isn't showing on the image I uploaded):
When I run the ggplot code separately I get this (which is what I want):

Would you know why the ggplot chunk isn't working? I tried storing input$variable on an object to run through the ggplot function but didn't work. I also tried to run aes_string(), without success.

ggplot( aes(x = .data[[input$feature]], fill = status))aes(x=.data[[input$..]]), not symbols. (Of course, can we trust the docs? ggplot2-book.org/… still recommends the long-deprecatedaes_(..).)