Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/compileChapter.R
Compile a Rmarkdown file - typically a chapter of a book -
so that extractCached
calls work correctly in other chapters.
1 | compileChapter(path, cache = TRUE)
|
path |
String containing a path to an Rmarkdown file. |
cache |
Logical scalar indicating whether the compilation should be cached. |
Compilation is performed in an isolated session using r
from the callr package.
This ensures that settings from one chapter do not affect the next chapter.
If an error is encountered during compilation of any Rmarkdown file,
the standard output of render
leading up to the error is printed out before the function exists.
The specified file is (re)compiled to generate the corresponding *_cache
directories.
NULL
is invisibly returned.
Aaron Lun
extractCached
, which calls this function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | tmp <- tempfile(fileext=".Rmd")
write(file=tmp, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```
```{r}
rodan <- 1
```")
compileChapter(tmp)
file.exists(sub(".Rmd$", ".html", tmp)) # output HTML exists.
file.exists(sub(".Rmd$", "_cache", tmp)) # output cache exists.
exists("rodan") # FALSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.