Debian Codegraph @

man/knit_child.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/output.R
3 \name{knit_child}
4 \alias{knit_child}
5 \title{Knit a child document}
6 \usage{
7 knit_child(..., options = NULL, envir = knit_global())
8 }
9 \arguments{
10 \item{...}{Arguments passed to \code{\link{knit}}.}
11
12 \item{options}{A list of chunk options to be used as global options inside
13 the child document. When one uses the \code{child}
14 option in a parent chunk, the chunk options of the parent chunk will be
15 passed to the \code{options} argument here. Ignored if not a list.}
16
17 \item{envir}{Environment in which code chunks are to be evaluated, for
18 example, \code{\link{parent.frame}()}, \code{\link{new.env}()}, or
19 \code{\link{globalenv}()}).}
20 }
21 \value{
22 A character string of the content of the compiled child document is
23 returned as a character string so it can be written back to the parent
24 document directly.
25 }
26 \description{
27 This function knits a child document and returns a character string to input
28 the result into the main document. It is designed to be used in the chunk
29 option \code{child} and serves as the alternative to the
30 \command{SweaveInput} command in Sweave.
31 }
32 \note{
33 This function is not supposed be called directly like
34 \code{\link{knit}()}; instead it must be placed in a parent document to let
35 \code{\link{knit}()} call it indirectly.
36
37 The path of the child document is determined relative to the parent document.
38 }
39 \examples{
40 # you can write \Sexpr{knit_child('child-doc.Rnw')} in an Rnw file 'main.Rnw'
41 # to input results from child-doc.Rnw in main.tex
42
43 # comment out the child doc by \Sexpr{knit_child('child-doc.Rnw', eval =
44 # FALSE)}
45 }
46 \references{
47 \url{https://yihui.org/knitr/demo/child/}
48 }