Description Usage Arguments Details Value Author(s) Examples
View source: R/updateDependencies.R
Update the book's DESCRIPTION file with the latest dependencies.
1 2 3 4 5 6 7 | updateDependencies(
dir = ".",
extra = NULL,
indent = 4,
field = "Suggests",
...
)
|
dir |
String containing the path to the directory containing the book |
extra |
Character vector of extra packages to be added to imports,
usually from packages that are in |
indent |
Integer scalar specifying the size of the indent to use when listing packages. |
field |
String specifying the dependency field to store the packages in.
Defaults to |
... |
Further arguments to pass to |
The book DESCRIPTION is useful for quick installation of all packages required across all chapters.
For example, it is used by https://github.com/LTLA/TrojanBookBuilder to populate a trojan package's dependencies,
ensuring that all packages are available when the book itself is compiled.
The specified field in the DESCRIPTION file in dir is updated.
NULL is invisibly returned.
Aaron Lun
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | dir <- tempfile()
dir.create(dir)
write(file=file.path(dir, "DESCRIPTION"),
"Package: son.of.godzilla
Version: 0.0.1
Description: Like godzilla, but smaller.")
tmp <- file.path(dir, "alpha.Rmd")
write(file=tmp, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```
```{r}
A::func
library(C)
```")
tmp <- file.path(dir, "bravo.Rmd")
write(file=tmp, "```{r, echo=FALSE, results='asis'}
rebook::chapterPreamble()
```
```{r}
require(D)
B::more
```")
updateDependencies(dir)
cat(readLines(file.path(dir, "DESCRIPTION")), sep="\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.