register_knitr_engine(override = TRUE)
(logical) Override knitr's built-in, RStan-based engine for
Stan? The default is
TRUE. See Details.
override = TRUE (default), this registers CmdStanR's knitr engine as the
stan chunks, replacing knitr's built-in, RStan-based engine. If
override = FALSE, this registers a
cmdstan engine so that both engines
may be used in the same R Markdown document. If the template supports syntax
highlighting for the Stan language, the
cmdstan chunks will have
syntax highlighting applied to them.
See the vignette R Markdown CmdStan Engine for an example.
Note: When running chunks interactively in RStudio (e.g. when using
R Notebooks), it has
been observed that the built-in, RStan-based engine is used for
chunks even when CmdStanR's engine has been registered in the session. When
the R Markdown document is knit/rendered, the correct engine is used. As a
workaround, when running chunks interactively, it is recommended to use the
override = FALSE option and change
stan chunks to be
If you would like to keep
stan chunks as
stan chunks, it is possible to
engine = "cmdstan" in the chunk options after registering the
cmdstan engine with
override = FALSE.