sourceRFunctions <- function(dir, local = FALSE) {
# Source all .R files in a directory
#
# Arguments:
# dir {string} -- directory with .R files to source
# local {bool} -- 'local' parameter passed into `source()` function
#
# Returns:
# nothing
if(!dir.exists(dir)) { message(sprintf("'%s' does not exist", dir)); return(NULL) }
RFunctions = list.files(path=dir, pattern="\\.(R|r)", full.names=TRUE)
if(!length(RFunctions)) { return(NULL) }
for(fn in RFunctions) source(fn, local=local)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.