File: zzz%2Cshiny.R

package info (click to toggle)
r-cran-progressr 0.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,132 kB
  • sloc: sh: 13; makefile: 7
file content (20 lines) | stat: -rw-r--r-- 469 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
source("incl/start.R")

if (requireNamespace("shiny", quietly = TRUE)) {
  ## This will generate:
  ## Error in shiny::withProgress(expr, ..., env = env, quoted = TRUE) : 
  ## 'session' is not a ShinySession object.
  res <- tryCatch({
    withProgressShiny({
      p <- progressor(3L)
      y <- lapply(1:3, function(n) {
        p()
        slow_sum(1:n, stdout=TRUE, message=TRUE)
      })
      y
    })
  }, error = identity)
  print(res)
}

source("incl/end.R")