File: summary_stats_param.R

package info (click to toggle)
r-cran-shinystan 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,172 kB
  • sloc: sh: 15; makefile: 7
file content (33 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# posterior summary statistics for a single parameter
parameter_summary <- reactive({
  validate(need(input$param != "", message = FALSE))
  do.call(
    ".param_summary", 
    args = list(
      param = input$param,
      summary = SUMMARY
    )
  )
})

output$param_name <- renderText({
  input$param
})
output$parameter_summary_out <- DT::renderDataTable({
  DT::datatable({
    as.data.frame(round(parameter_summary(), 2))
  }, 
  rownames = FALSE,
  options = list(
    paging = FALSE, 
    searching = FALSE, 
    info = FALSE, 
    ordering = FALSE,
    autoWidth = TRUE,
    columnDefs = list(list(sClass="alignRight", targets ="_all")),
    initComplete = htmlwidgets::JS( # change background color of table header
      'function(settings, json) {
      $(this.api().table().header()).css({"background-color": "transparent", "color": "black"});
      }')
  ))
})