Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/createMakefile.R
Create a Makefile for compiling individual chapters, in a manner that respects the dependencies between chapters.
1 | createMakefile(dir = ".", pattern = "\\.Rmd$", ..., fname = "Makefile")
|
dir |
String containing the path to the directory containing Rmarkdown reports.
This is searched recursively for all files ending in |
pattern |
Further arguments to pass to |
... |
Further arguments to pass to |
fname |
String containing the name of the output Makefile. |
The main benefit of using a Makefile is that the generation of the chapter caches can be done in parallel. Then, the bookdown step can just serially retrieve the cache contents for rapid rendering.
The Makefile uses the markdown output file as an indicator of successful knit
ting of a chapter.
Caches are left in the current working directory after the compilation of each report.
It is assumed that bookdown's render_book
is smart enough to find and use these caches.
A Makefile is created in dir
with the name fname
and a NULL
is invisibly returned.
Aaron Lun
buildChapterGraph
, to detect dependencies between chapters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | dir <- tempfile()
dir.create(dir)
tmp1 <- file.path(dir, "alpha.Rmd")
write(file=tmp1, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```
```{r}
rodan <- 1
```")
tmp2 <- file.path(dir, "bravo.Rmd")
write(file=tmp2, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```
```{r}
extractCached('alpha.Rmd')
```")
# Creating the Makefile:
createMakefile(dir)
cat(readLines(file.path(dir, "Makefile")), sep="\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.