Crandore Hub

scriptloc

Get the Location of the R Script that is Being Sourced/Executed

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.

Versions across snapshots

VersionRepositoryFileSize
1.0.0 rolling linux/jammy R-4.5 scriptloc_1.0.0.tar.gz 69.9 KiB
1.0.0 rolling linux/noble R-4.5 scriptloc_1.0.0.tar.gz 70.0 KiB
1.0.0 rolling source/ R- scriptloc_1.0.0.tar.gz 57.0 KiB
1.0.0 latest linux/jammy R-4.5 scriptloc_1.0.0.tar.gz 69.9 KiB
1.0.0 latest linux/noble R-4.5 scriptloc_1.0.0.tar.gz 70.0 KiB
1.0.0 latest source/ R- scriptloc_1.0.0.tar.gz 57.0 KiB
1.0.0 2026-04-26 source/ R- scriptloc_1.0.0.tar.gz 57.0 KiB
1.0.0 2026-04-23 source/ R- scriptloc_1.0.0.tar.gz 57.0 KiB
1.0.0 2026-04-09 windows/windows R-4.5 scriptloc_1.0.0.zip 71.6 KiB
1.0.0 2025-04-20 source/ R- scriptloc_1.0.0.tar.gz 57.0 KiB

Dependencies (latest)

Suggests