| load_all | R Documentation |
Sources all R files in a package for interactive development, without requiring a full install.
load_all(path = ".", env = new.env(parent = globalenv()), quiet = TRUE)
path |
Path to package root directory. |
env |
Environment to source files into. Defaults to a fresh environment whose parent is the global environment. |
quiet |
Logical. Suppress file sourcing messages? Default TRUE. |
The environment into which files were sourced (invisibly). Does not modify the search path. If you want search-path behavior, call 'attach()' yourself:
attach(tinypkgr::load_all(), name = "tinypkgr:mypkg")
kitten for scaffolding a new package.
# Scaffold a throwaway package in tempdir() and source its R/ files.
pkg <- file.path(tempdir(), "loadpkg")
dir.create(file.path(pkg, "R"), recursive = TRUE, showWarnings = FALSE)
writeLines(c(
"Package: loadpkg",
"Title: Example",
"Version: 0.0.1",
"Authors@R: person('A', 'B', email = 'a@b.com', role = c('aut','cre'))",
"Description: Example.",
"License: GPL-3"
), file.path(pkg, "DESCRIPTION"))
writeLines("add <- function(x, y) x + y", file.path(pkg, "R", "add.R"))
e <- load_all(pkg)
e$add(2, 3)
unlink(pkg, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.