Learn R Programming

this.path (version 0.4.4)

this.path-package: this.path

Description

this.path

Arguments

Details

There are only two exported functions from this package being this.path and this.dir.

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

this.dir() is a shorter way of writing dirname(this.path()). It returns the full path of the directory where the executing script is located.

There are two unexported functions from this package being file.encode and file.open. Until they have been sufficiently tested, they will remain unexported. The names and behaviour will not change, so they can be used if desired (see pkg:::name), but they may not work for strange characters.

file.encode formats a character vector such that it can be used at the Windows command-line / / Unix terminal. It is used in section Examples of this.path and Running.R.from.the.command-line.

file.open opens the specified file using the default application for that file's extension. It is used in section Examples of this.path.

If you are using either of these unexported functions in a package that is being submitted to CRAN, a WARNING will be issued:

Unexported objects imported by ':::' calls: 'this.path:::file.encode' 'this.path:::file.open'

Instead, put these two functions in your package and use them instead. This will eliminate the WARNING.

file.encode <- function (...) get("file.encode", envir = asNamespace("this.path"), inherits = FALSE)(...)

file.open <- function (...) get("file.open", envir = asNamespace("this.path"), inherits = FALSE)(...)

See Also

this.path

source

sys.source

testthat::source_file

Running.R.from.the.command-line