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.

Version: 1.0.0
Depends: R (≥ 3.6.0)
Suggests: knitr, rmarkdown, prettydoc
Published: 2023-08-17
DOI: 10.32614/CRAN.package.scriptloc
Author: Naren Chandran Sakthivel ORCID iD [aut, cre]
Maintainer: Naren Chandran Sakthivel <narenschandran at>
License: MIT + file LICENSE
NeedsCompilation: no
Materials: README
CRAN checks: scriptloc results


Reference manual: scriptloc.pdf
Vignettes: Introdution to scriptloc and its usecase


Package source: scriptloc_1.0.0.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
macOS binaries: r-release (arm64): scriptloc_1.0.0.tgz, r-oldrel (arm64): scriptloc_1.0.0.tgz, r-release (x86_64): scriptloc_1.0.0.tgz, r-oldrel (x86_64): scriptloc_1.0.0.tgz


Please use the canonical form to link to this page.