Learn R Programming

this.path (version 2.5.0)

try.this.path: Attempt to Determine Script's Filename

Description

try.this.path() attempts to return this.path(), returning this.path(original = TRUE) if that fails, returning NA_character_ if that fails as well.

Usage

try.this.path(contents = FALSE, local = FALSE, n = 0,
              envir = parent.frame(n + 1),
              matchThisEnv = getOption("topLevelEnvironment"),
              srcfile = if (n) sys.parent(n) else 0)

try.shFILE()

Value

character string.

Arguments

contents, local, n, envir, matchThisEnv, srcfile

See ?this.path().

Details

This should NOT be used to construct file paths against the script's directory. This should exclusively be used for diagnostic messages / / warnings / / errors / / logging. The returned path may not exist, may be relative instead of absolute, or may be undefined.

Examples

Run this code
try.shFILE()
try.this.path()
try.this.path(contents = TRUE)

Run the code above in your browser using DataLab