parse_scripts | R Documentation |
Parse all given R scripts into a tree structure
parse_scripts(
root,
scripts = dir(root, "\\.R$", ignore.case = TRUE, recursive = TRUE),
dbg = TRUE
)
root |
root directory to which the relative paths given in
|
scripts |
relative file paths to R scripts. By default all files ending
with ".R" or ".r" below the |
dbg |
if |
to_full_script_info
## Not run:
# Download some example code files from github...
url.base <- "https://raw.githubusercontent.com/hsonne/blockrand2/master/R/"
urls <- paste0(url.base, c("blockrand2_create.R", "blockrand2_main.R"))
targetdir <- file.path(tempdir(), "blockrand2")
targetdir <- kwb.utils::createDirectory(targetdir)
for (url in urls) {
download.file(url, file.path(targetdir, basename(url)))
}
# By default, all R scripts below the root are parse
trees <- parse_scripts(root = targetdir)
# All elements of trees are expressions
sapply(trees, is.expression)
# Analyse the scripts on the script level
scriptInfo <- to_full_script_info(trees)
scriptInfo
# Analyse the scripts on the function level
functionInfo <- get_full_function_info(trees)
functionInfo
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.