Description Usage Arguments Details Value Examples
Creates a weighted adjacency matrix, in which (i,j) = x
means that item i
is in relation x
with item
j
. The resulting graph is plotted.
1 2 3 4 5 6 7 8 9 | repo_dependencies(
tags = NULL,
tagfun = "OR",
depends = T,
attached = T,
generated = T,
plot = T,
...
)
|
tags |
Only show nodes matching tags |
tagfun |
Function specifying how to match tags (by default
"OR": match any of |
depends |
If TRUE, show "depends on" edges. |
attached |
If TRUE, show "attached to" edges. |
generated |
If TRUE, show "generated by" edges. |
plot |
If TRUE (default), plot the dependency graph. |
... |
Other parameters passed to the |
The relation between any two items i
and j
can have
values 1, 2 or 3, respectively meaning:
depends on: to build item i
, item j
was necessary.
attached to: item i
is an attachment item and is attached to
item j
.
generated by: item i
has been generated by item j
. Item
j
is usually an attachment containing the source code that
generated item i
.
Adjacency matrix representing the graph, with edges labeled 1, 2, 3 corresponding to "depends", "attached" and "generated" respectively.
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 31 32 33 34 35 | ## Repository creation
rp_path <- file.path(tempdir(), "example_repo")
rp <- repo_open(rp_path, TRUE)
## Producing some irrelevant data
data1 <- 1:10
data2 <- data1 * 2
data3 <- data1 + data2
## Putting the data in the database, specifying dependencies
rp$put(data1, "item1", "First item",
"repo_dependencies")
rp$put(data2, "item2", "Item dependent on item1",
"repo_dependencies", depends="item1")
rp$put(data3, "item3", "Item dependent on item1 and item2",
"repo_dependencies", depends=c("item1", "item2"))
## Creating a temporary plot and attaching it
fpath <- file.path(rp$root(), "temp.pdf")
pdf(fpath)
plot(data1)
dev.off()
rp$attach(fpath, "visualization of item1", "plot",
to="item1")
## Obtaining the dependency matrix
depmat <- rp$dependencies(plot=FALSE)
print(depmat)
## The matrix can be plotted as a graph (requires igraph package)
rp$dependencies()
## The following hides "generated" edges
rp$dependencies(generated=FALSE)
## wiping temporary repo
unlink(rp_path, TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.