View source: R/updateDependencies.R
updateDependencies | R Documentation |
Update the book package's DESCRIPTION file with the latest dependencies.
updateDependencies(
dir = ".",
path = file.path(dir, "DESCRIPTION"),
extra = NULL,
indent = 4,
field = "Depends",
...
)
dir |
String containing the path to the directory containing the book. |
path |
String containing the path to the DESCRIPTION file. |
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
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.