View source: R/sourceFunctions.R
| sourceFunctions | R Documentation |
Loads all of an app's helper functions in one call, so app.R doesn't need
a source() line per file. Every file ending in .R in the folder is
sourced, in alphabetical order. Subfolders are not searched.
sourceFunctions(functionFolderPath, envir = parent.frame())
functionFolderPath |
Path to the folder holding the |
envir |
Environment to load the functions into. Defaults to the one
|
A relative path is looked up from the working directory first. If it isn't
found there, it is looked up from the project root with here::here().
The paths of the sourced files, invisibly.
folder <- file.path(tempdir(), "Functions")
dir.create(folder, showWarnings = FALSE)
writeLines("addOne <- function(x) x + 1", file.path(folder, "addOne.R"))
sourceFunctions(folder)
addOne(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.