Learn R Programming

fritools (version 3.3.0)

get_script_name: Get the Name of the R Code File or set it to default

Description

The code file name is retrieved only for R CMD BATCH and Rscript, if R is used interactively, the name is set to default, even if you're working with code stored in a (named) file on disk.

Usage

get_script_name(default = "interactive_R_session")

Arguments

default

the name to return if R is run interactively.

Value

A vector of length 1 and mode character giving the name of the R code file if R was run via R CMD BATCH or Rscript, the given default otherwise.

See Also

Other script path getter functions: get_r_cmd_batch_script_path(), get_rscript_script_path(), get_script_path()

Examples

Run this code
# NOT RUN {
get_script_name(default = 'foobar.R')
# }

Run the code above in your browser using DataLab