Description Usage Details Value Examples
View source: R/decision_logic.R
Provides functionality to decide how the progress should be written, if at all.
1 |
This function makes decisions about how the progress bar should be displayed based on whether:
The code is being run in an interactive session or not
The code is part of a knitr
evaluation using knit()
or rmarkdown::render()
Options set by the user. These options include:
kpb.suppress_noninteractive: a logical value. Whether to suppress output when being run non-interactively.
kpb.use_logfile: logical, should a log-file be used for output?
kpb.log_file: character string defining the log-file to use. kpb.use_logfile must be TRUE
.
kpb.log_pattern: character string providing a pattern to use, will be combined with the chunk
label to create a log-file for each knitr chunk. kpb.use_logfile must be TRUE
.
Based on these, it will either return a newly opened connection, either via
stderr()
, stdout()
, or a file connection via file("logfile.log", open = "w")
.
Note that for files this will overwrite a previously existing file, and the contents
will be lost.
a write-able connection or NULL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# suppress output when not interactive
options(kpb.suppress_noninteractive = TRUE)
# use a log-file, will default to kpb_output.txt
options(kpb.use_logfile = TRUE)
# use a specific log-file
options(kpb.use_logfile = TRUE)
options(kpb.log_file = "progress.txt")
# use a log-file based on chunk names
options(kpb.use_logfile = TRUE)
options(kpb.log_pattern = "pb_out_")
# for a document with a chunk labeled: "longcalc", this will generate "pb_out_longcalc.log"
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.