inst/shiny_module-master/oldfaithful/ReadMe.md

title: "Shiny Module Diagnostics" author: "Brian S Yandell" date: "May 9, 2017" output: html_document

This folder explores the Old Faithful example in some detail. Examples are:

This example has a panel for the density bandwidth slider that only appears conditionally on a request to show density. In the simple example, the condition is relatively straightforward. However, when using modules, it is necessary to be a bit tricky. The condition is interpreted via javascript, and that clashes with the shiny module namespace conventions slightly.

The conditionalPanel() is one way to do a conditional change to layout; it is done within the ui() component of a shiny app. Another way is to use uiOutput() in ui() and renderUI() in server(). This is done in the oldfaithful_sidepanel_renderUI.R example.

This is about diagnostics with the Old Faithful example.

Inspecting input with modules using breakpoints or browser(). Put breakpoint at hist(faithful$eruptions, in oldfaithful_sidepanel.R and query input:

Browse[2]> names(input)
[1] "bw_adjust"      "density"        "individual_obs" "n_breaks"      
Browse[2]> ns("density")
[1] "faithful-density"
Browse[2]> input$density
[1] TRUE
Browse[2]> class(input)
[1] "reactivevalues"
Browse[2]> str(input)

Server logic order is arbitrary and tricky. Don't expect things to be done in any particular order. Run oldfaithful_sidepanel_renderUI.R and notice error messages printed on console as you click checkbox for Show density estimate.



mathematiguy/shinyexplorer documentation built on May 26, 2019, 6:35 a.m.