Created
February 28, 2025 16:19
-
-
Save tanho63/7de44fd7c4d25afd60aa952ad4888256 to your computer and use it in GitHub Desktop.
ggplot .data pronoun shiny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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