Learn R Programming

optigrab (version 0.9.2.1)

this_file: this_file

Description

Name or path to the current file

Usage

this_file(opts = commandArgs(), local = TRUE, full.path = TRUE)

Arguments

opts

character; vector of arguments. (Default: commandArgs())

local

logical; if TRUE returns the most currently sourced script as opposed to the orignal/first source script. (Default: TRUE)

full.path

logical; Whetther to return the full path to the sourced file. (Default: TRUE)

Value

one-element character vector with the path to the current file; returns NA is in an interactive session not in a file.

Details

this_file returns the name or path of the executing file whehter the file was invoked from Rscript or in an interactive session. Further it source

Argument local controls whether it is the current file (TRUE) or the orignal, top-level file.

References

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

See Also

Examples

Run this code
# NOT RUN {
  this_file()

# }

Run the code above in your browser using DataLab