| fn_graph | R Documentation |
Pulls the AST symbol index via symbols and renders
internal function-to-function call edges as SVG. External calls
(into other packages) are dropped by default.
fn_graph(
project_dir,
include_external = FALSE,
...,
cache_dir = file.path(tools::R_user_dir("saber", "cache"), "symbols")
)
project_dir |
Path to the project directory (an R package root). |
include_external |
If |
... |
Passed through to |
cache_dir |
Directory for the underlying |
Character vector of SVG lines. Write with writeLines().
d <- file.path(tempdir(), "fngdemo")
dir.create(file.path(d, "R"), recursive = TRUE, showWarnings = FALSE)
writeLines(c("Package: demo", "Version: 0.1.0"),
file.path(d, "DESCRIPTION"))
writeLines("add <- function(x, y) x + y", file.path(d, "R", "add.R"))
writeLines("double <- function(x) add(x, x)",
file.path(d, "R", "double.R"))
svg <- fn_graph(d, cache_dir = tempdir())
writeLines(svg, tempfile(fileext = ".svg"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.