-
Notifications
You must be signed in to change notification settings - Fork 0
❗ This is a read-only mirror of the CRAN R package repository. scriptName — Determine a Script's Filename from Within the Script Itself. Homepage: https://github.com/MullinsLab/scriptName Report bugs for this package: https://github.com/MullinsLab/scriptName/issues
License
cran/scriptName
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Determine a script's filename from within the script itself Description: A small set of functions wrapping up the call stack and command line inspection needed to determine a running script's filename from within the script itself. Usage: current_filename() current_source_filename() current_cli_filename() Details: ‘current_filename()’ returns the result of ‘current_source_filename()’ if not NULL, otherwise the result of ‘current_cli_filename()’, which might be NULL. You should use this wrapper function rather than the more-specific functions unless you have a very specific need. ‘current_source_filename()’ returns the filename from the most recent call to ‘source’ in the current call stack. From within a sourced script, this is the filename of the script itself. ‘current_cli_filename()’ returns the filename found on the command line invocation of R or Rscript. This may or may not be the caller's file if there's been an intervening ‘source’. Value: A character vector of length 1 if a script name can be found, otherwise NULL. No manipulation is done to the filename, so it may be relative or absolute. Examples: # Put this in example.R and try running source("example.R") # and `Rscript example.R` filename <- current_filename() print(filename)
About
❗ This is a read-only mirror of the CRAN R package repository. scriptName — Determine a Script's Filename from Within the Script Itself. Homepage: https://github.com/MullinsLab/scriptName Report bugs for this package: https://github.com/MullinsLab/scriptName/issues
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published