For interactive sessions: Calls getSourceEditorContext to obtain the source context. The source editor context refers to the active file opened in RStudio.

For non-interactive sessions: Parses commandArgs to obtain the name of the script being executed.

get_source_file()

Value

returns the path of the source editor or the script being executed.