Skip to content

Instantly share code, notes, and snippets.

@nwstephens
Last active April 4, 2016 15:31
Show Gist options
  • Select an option

  • Save nwstephens/3b840fb810cfc36643517d5202269fe6 to your computer and use it in GitHub Desktop.

Select an option

Save nwstephens/3b840fb810cfc36643517d5202269fe6 to your computer and use it in GitHub Desktop.
Gadget gets error at startup
# 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