knit_child | R Documentation |
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())
... |
Arguments passed to |
options |
A list of chunk options to be used as global options inside
the child document. When one uses the |
envir |
Environment in which code chunks are to be evaluated, for
example, |
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.
This function is not supposed be called directly like
knit()
; instead it must be placed in a parent document to let
knit()
call it indirectly.
The path of the child document is determined relative to the parent document.
https://yihui.org/knitr/demo/child/
# 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)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.