this.path-package {this.path}R Documentation

Get Executing Script's Path, from 'RStudio', 'Rgui', 'VSCode', 'Rscript' (Shells Including Windows Command-Line / / Unix Terminal), and 'source'

Description

Determine the full path of the executing script. Works when running a line or selection from a script in 'RStudio', 'Rgui', and 'VSCode', when using 'source', 'sys.source', 'debugSource' in 'RStudio', and 'testthat::source_file', and when running from a shell.

Details

The three most important functions from this package are this.path, this.dir, and here.

this.path() returns the normalized path of the executing script.

this.dir() returns the normalized path of the directory in which the executing script is located.

here() constructs file paths relative to the executing script's directory.

Note

This package started from a stack overflow posting, found at:

https://stackoverflow.com/questions/1815606/determine-path-of-the-executing-script

If you like this package, please consider upvoting my answer so that more people will see it! If you have an issue with this package, please use utils::bug.report(package = "this.path") to report your issue.

Author(s)

Andrew Simmons

Maintainer: Andrew Simmons <akwsimmo@gmail.com>

See Also

The main functions from this.path: this.path, this.dir, here

Check this.path() is functioning correctly: check.path, check.dir

Extract FILE from command line arguments: shFILE, normalized.shFILE

source, sys.source, debugSource, testthat::source_file

R.from.shell


[Package this.path version 0.11.0 Index]