Skip to content

Instantly share code, notes, and snippets.

@tanho63
Created February 28, 2025 16:19
Show Gist options
  • Save tanho63/7de44fd7c4d25afd60aa952ad4888256 to your computer and use it in GitHub Desktop.
Save tanho63/7de44fd7c4d25afd60aa952ad4888256 to your computer and use it in GitHub Desktop.
ggplot .data pronoun shiny
library(shiny)
library(ggplot2)
ui <- fluidPage(
selectInput("var", choices = names(mtcars),label = "choose column"),
br(),
plotOutput("plot")
)
server <- function(input, output, session) {
output$plot <- renderPlot({
mtcars |>
ggplot(aes(x = .data[[input$var]])) +
geom_histogram()
})
}
shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment