Last active
April 4, 2016 15:31
-
-
Save nwstephens/3b840fb810cfc36643517d5202269fe6 to your computer and use it in GitHub Desktop.
Gadget gets error at startup
This file contains hidden or 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
| # This code produces an error at startup | |
| require(miniUI) | |
| require(shiny) | |
| ff <- function () | |
| { | |
| ui <- miniPage( | |
| gadgetTitleBar("Variable Profiler"), | |
| miniContentPanel( | |
| selectInput("data", "Data frame", choices = c('iris','mtcars')), | |
| selectInput("colSelect", "Columns", choices = NULL), | |
| plotOutput("plot") | |
| )) | |
| server <- function(input, output, session) { | |
| data <- reactive({ | |
| get(input$data) | |
| }) | |
| vec <- reactive({ | |
| data()[[input$colSelect]] | |
| }) | |
| observe({ | |
| updateSelectInput(session, "colSelect", choices = names(data())) | |
| }) | |
| output$plot <- renderPlot({ | |
| #validate(need(is.null(input$colSelect), 'NULL Column Selected')) # does not solve error | |
| hist(vec()) | |
| }) | |
| observeEvent(input$done, { | |
| stopApp(out) | |
| }) | |
| } | |
| runGadget(ui, server) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment