buildChapterGraph: Build the chapter dependency graph

Description Usage Arguments Value Author(s) Examples

View source: R/buildChapterGraph.R

Description

Build the dependency graph between chapter based on their extractCached calls to each other.

Usage

1
buildChapterGraph(dir, recursive = TRUE, pattern = "\\.Rmd$")

Arguments

dir

String containing the path to the directory containing Rmarkdown reports. This is searched recursively for all files ending in ".Rmd".

recursive

Further arguments to pass to list.files when searching for Rmarkdown reports.

pattern

Further arguments to pass to list.files when searching for Rmarkdown reports.

Value

A directed graph object from the igraph package, where each node is a chapter and is connected to its dependencies by an edge.

Author(s)

Aaron Lun

Examples

 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
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')
```")

# Building the chapter graph:
g <- buildChapterGraph(dir)
plot(g)
 

rebook documentation built on Nov. 8, 2020, 4:56 p.m.