Skip to contents

Call it once in a Shiny server function. Every gsm.bio widget drawn in the page with a renderWidget_*() function then asks this session for its statistics: the chart sends the function's name, the rows it draws and the arguments, and is sent back what the function returns. So every view a reader reaches has its statistics, computed by this R, where a saved page has only those stored when it was made.

Usage

Serve_Statistics(session = shiny::getDefaultReactiveDomain())

Arguments

session

The Shiny session. By default the one whose server function is running.

Value

The observer that answers, invisibly.

What the session will run

The nine statistics functions and nothing else: Analyze_GroupDifference(), Analyze_GroupDifferenceBy(), Analyze_DifferenceGrid(), Analyze_Correlation(), Analyze_CorrelationMatrix(), Analyze_Fit(), Analyze_Contingency(), Analyze_Survival() and Analyze_Screen(). The name a page sends is compared with that list. Any other name is answered with a sentence saying so, and nothing is called. The rows and the arguments are read as data and never as R code.

What crosses to the server

The rows a chart draws travel with each request, because the chart works them out in the page: a change from baseline, the filters and the cuts are applied there, and R tests those rows and no others. Nothing is kept between requests.

An answer is converted for the page exactly as a stored result is, so a chart reads the two alike. The line under the chart says the result was computed on this server, by which R and which gsm.bio.

See also

The renderWidget_*() functions in gsm.bio-shiny.

Other shiny: RunApp(), gsm.bio-shiny

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  shiny::shinyApp(
    ui = shiny::fluidPage(Widget_GroupComparisonOutput("chart")),
    server = function(input, output, session) {
      Serve_Statistics()
      output$chart <- renderWidget_GroupComparison(
        Widget_GroupComparison(Synthetic_Results, Synthetic_Participants)
      )
    }
  )
}