| symbols | R Documentation |
Parse R source files to extract function definitions and calls.
symbols(project_dir,
cache_dir = file.path(tools::R_user_dir("saber", "cache"), "symbols"))
project_dir |
Path to the project directory. |
cache_dir |
Directory for symbol cache files. |
A list with components:
data.frame(name, file, line, exported)
data.frame(caller, callee, file, line)
# Create a minimal project with R source files
d <- file.path(tempdir(), "demopkg")
dir.create(file.path(d, "R"), recursive = TRUE, showWarnings = FALSE)
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"))
idx <- symbols(d, cache_dir = tempdir())
idx$defs # function definitions
idx$calls # call relationships (double calls add)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.