File: progress.R

package info (click to toggle)
r-cran-readxl 1.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,044 kB
  • sloc: ansic: 4,854; cpp: 3,213; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#' Determine whether to show progress spinner
#'
#' @description By default, readxl displays a progress spinner **unless**
#'   one of the following is `TRUE`:
#' * The spinner is explicitly disabled by setting
#'   `options(readxl.show_progress = FALSE)`.
#' * The code is run in a non-interactive session (`interactive()` is `FALSE`).
#' * The code is run by knitr / rmarkdown.
#' * The code is run in an RStudio notebook chunk.
#' readxl uses the [progress
#' package](https://cran.r-project.org/package=progress) under-the-hood and
#' therefore is also sensitive to any options that it consults.
#' @export
readxl_progress <- function() {
  ## based on readr:::show_progress()
  isTRUE(getOption("readxl.show_progress", default = TRUE)) &&
    interactive() &&
    !isTRUE(getOption("knitr.in.progress")) &&
    !isTRUE(getOption("rstudio.notebook.executing"))
}