scriptloc (Q5983015)
From MaRDI portal
| This is the item page for this Wikibase entity, intended for internal use and editing purposes. Please use this page instead for the normal view: scriptloc |
Get the Location of the R Script that is Being Sourced/Executed
| Language | Label | Description | Also known as |
|---|---|---|---|
| English | scriptloc |
Get the Location of the R Script that is Being Sourced/Executed |
Statements
Provides functions to retrieve the location of R scripts loaded through the source() function or run from the command line using the Rscript command. This functionality is analogous to the Bash shell's ${BASH_SOURCE[0]}. Users can first set the project root's path relative to the script path and then all subsequent paths relative to the root. This system ensures that all paths lead to the same location regardless of where any script is executed/loaded from without resorting to the use of setwd() at the top of the scripts.
0 references
17 August 2023
0 references