Skip to contents

Downloads and sources R scripts stored in the improve repository. If the target is a folder or list of resources, the function recursively sources each script.

Usage

sourceR(ident, from = pwd(), addAsLink = TRUE)

Arguments

ident

Path, resource ID, or entity ID of the R script.

from

Root path for resolving relative paths. Defaults to pwd().

Logical. If TRUE, creates a link in the inventory for provenance tracking. Use improveClean() at workflow end to clean up links.

Value

Invisibly returns NULL. Scripts are sourced for their side effects.

Details

This function wraps getR to download the script, then calls source() on the local file path. When multiple resources are returned, each is sourced in sequence. Sourcing executes code in the current session, so ensure the script content is trusted and compatible with your environment.

References

ics1141

See also

getR to download scripts or RDS metadata, improveInit for module initialization

Examples

if (FALSE) { # \dontrun{
# Source a single script
sourceR("analysis/prepare_data.R")
} # }