Debian Codegraph @

man/knit_engines.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/engine.R
3 \docType{data}
4 \name{knit_engines}
5 \alias{knit_engines}
6 \title{Engines of other languages}
7 \format{
8 An object of class \code{list} of length 7.
9 }
10 \usage{
11 knit_engines
12 }
13 \description{
14 This object controls how to execute the code from languages other than R
15 (when the chunk option \code{engine} is not \code{'R'}). Each component in
16 this object is a function that takes a list of current chunk options
17 (including the source code) and returns a character string to be written into
18 the output.
19 }
20 \details{
21 The engine function has one argument \code{options}: the source code of the
22 current chunk is in \code{options$code}. Usually we can call external
23 programs to run the code via \code{\link{system2}}. Other chunk options are
24 also contained in this argument, e.g. \code{options$echo} and
25 \code{options$eval}, etc.
26
27 In most cases, \code{options$engine} can be directly used in command line to
28 execute the code, e.g. \code{python} or \code{ruby}, but sometimes we may
29 want to specify the path of the engine program, in which case we can pass it
30 through the \code{engine.path} option. For example, \code{engine='ruby',
31 engine.path='/usr/bin/ruby1.9.1'}. Additional command line arguments can be
32 passed through \code{options$engine.opts}, e.g. \code{engine='ruby',
33 engine.opts='-v'}.
34
35 See \code{str(knitr::knit_engines$get())} for a list of built-in language
36 engines.
37 }
38 \note{
39 The Leiningen engine \code{lein} requires lein-exec plugin; see
40 \url{https://github.com/yihui/knitr/issues/1176} for details.
41 }
42 \examples{
43 knit_engines$get("python")
44 knit_engines$get("awk")
45 names(knit_engines$get())
46 }
47 \references{
48 Usage: \url{https://yihui.org/knitr/objects/}; examples:
49 \url{https://yihui.org/knitr/demo/engines/}
50 }
51 \keyword{datasets}