Last chance! 50% off unlimited learning
Sale ends in
This function knits a child document and returns a character string to input
the result into the main document. It is designed to be used in the chunk
option child
and serves as the alternative to the
SweaveInput
command in Sweave.
knit_child(..., options = NULL, envir = knit_global())
A character string of the content of the compiled child document is returned as a character string so it can be written back to the parent document directly.
Arguments passed to knit
.
A list of chunk options to be used as global options inside
the child document. When one uses the child
option in a parent chunk, the chunk options of the parent chunk will be
passed to the options
argument here. Ignored if not a list.
Environment in which code chunks are to be evaluated, for
example, parent.frame()
, new.env()
, or
globalenv()
).
# you can write \Sexpr{knit_child('child-doc.Rnw')} in an Rnw file 'main.Rnw'
# to input results from child-doc.Rnw in main.tex
# comment out the child doc by \Sexpr{knit_child('child-doc.Rnw', eval =
# FALSE)}
Run the code above in your browser using DataLab