File: summary_stats.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 (36 lines) | stat: -rw-r--r-- 1,596 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
34
35
36
summary_stats <- reactive({
  `%>%` <- DT::`%>%`
  validate(need(input$table_digits, "loading"))
  DT::datatable(data = round(TABLE_STATS, digits = input$table_digits),
                colnames = c('mcse' = 'se_mean'),
                options = list(
                  colReorder = list(realtime = TRUE),
                  # dom = 'RBfClrTtip',
                  dom = "Bflrtip",
                  buttons = list('copy', 'print', list(
                    extend = 'collection',
                    buttons = c('csv', 'pdf'),
                    text = 'Download'
                  ), 
                  list(extend = 'colvis', columns = 1:ncol(TABLE_STATS))),
                  pageLength = 10,
                  pagingType = "full",
                  processing = TRUE,
                  deferRender = TRUE,
                  scrollY = 400,
                  scrollX = TRUE,
                  scrollCollapse = FALSE,
                  language = list(search = "_INPUT_", searchPlaceholder = "Regex searching"),
                  search = list(regex = TRUE)
                ),
                extensions =
                  c("Buttons", "ColReorder", "FixedColumns", "Scroller")) %>%
    DT::formatStyle(columns = "Rhat",
                    color = DT::styleInterval(1.1, c("blue", "red"))) %>%
    DT::formatRound(columns = "n_eff", digits = 0) # %>%
  #     DT::formatRound(columns = c("Rhat", "mean", "mcse", "sd", "2.5%", "25%",
  #                                 "50%", "75%", "97.5%"), digits = input$table_digits)
})
output$all_summary_out <- DT::renderDataTable({
  summary_stats()
})