This works for some of the included data sets. Plotting the entire data set bogs down my system, so I chose to plot only the 3rd and 4th columns. Obviously, that cannot be a good choice in every case but it does show the basic functionality of the app.
library(shiny)
library(ggplot2)
datasets <- data(package = "ggplot2")$results[, "Item"]
ui <- fluidPage(
selectInput("dataset", "Dataset", choices = datasets, selected= "mpg"),
verbatimTextOutput("summary"),
plotOutput("plot")
)
server <- function(input, output, session) {
dataset <- reactive({
get(input$dataset, "package:ggplot2")
})
output$summary <- renderPrint({
summary(dataset())
})
output$plot <- renderPlot({
plot(dataset()[[3]], dataset()[[4]])
})
}
shinyApp(ui = ui, server = server)