knitr (version 1.2)

knit_child: Knit a child document

Description

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.

Usage

knit_child(..., eval = TRUE)

Arguments

...
arguments passed to knit
eval
logical: whether to evaluate the child document

Value

  • 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.

References

http://yihui.name/knitr/demo/child/

Examples

Run this code
## 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 DataCamp Workspace