Learn R Programming

asciicast (version 1.0.0)

init_knitr_engine: Initialize the asciicast knitr engine

Description

Call this function in your Rmd file, to enable creating asciinema casts from code chunks.

Usage

init_knitr_engine(
  echo = FALSE,
  same_process = TRUE,
  timeout = 10,
  allow_errors = TRUE,
  startup = NULL,
  record_env = NULL,
  echo_input = TRUE,
  options = asciicast_knitr_options()
)

Arguments

echo

Whether to print the code of asciicast chunks.

same_process

Whether to run all asciicast chunks in the same R process. To restart this R process, call init_knitr_engine() again.

timeout

Idle timeout, in seconds If the R subprocess running the recording does not answer within this limit, it is killed and the recording stops. Update this for slow running code, that produces no output as it runs.

allow_errors

Whether to cast errors properly. If this is set to TRUE, then asciicast overwrites the "error" option. Only change this if you know what you are doing.

startup

Quoted language object to run in the subprocess before starting the recording.

record_env

Environment variables to set for the R subprocess.

echo_input

Whether to echo the input in the asciicast recording.

options

R options to set (via base::options(), in the background R process that performs the recording. See asciicast_knitr_options() for the defaults.

Examples

Call this function from an Rmd chunk and then you can use the asciicast knitr engine:

```{r echo = FALSE, results = "hide"}
asciicast::init_knitr_engine()
```
```{asciicast, cache = TRUE}`
#' Rows: 10
# This is an asciicast example
loadedNamespaces()
```

See Also

Other asciicast in Rmd: asciicast_knitr_options()