Learn R Programming

scriptloc (version 1.0.0)

script_dir_get: Return directory where the script exists

Description

This is a convenient wrapper to dirname(scriptloc())

Usage

script_dir_get()

Arguments

Value

Returns either a single string with path to the file being executed, or NULL

Examples

Run this code
writeLines("library(scriptloc); script_dir <- script_dir_get(); print(script_dir)", "dir-example.R")
source("dir-example.R")
file.remove("dir-example.R")

Run the code above in your browser using DataLab