Learn R Programming

box (version 1.2.0)

script_path: Set the base path of the script

Description

box::set_script_path(path) explicitly tells box the path of a given script from which it is called; box::script_path() returns the previously set path.

Usage

box::set_script_path(path)

box::script_path()

Value

Both box::script_path and box::set_script_path return the previously set script path, or NULL if none was explicitly set. box::set_script_path returns its value invisibly.

Arguments

path

character string containing the relative or absolute path to the currently executing R code file, or NULL to reset the path.

Details

box needs to know the base path of the topmost calling R context (i.e. the script) to find relative import locations. In most cases, box can figure the path out automatically. However, in some cases third-party packages load code in a way in which box cannot find the correct path of the script any more. box::set_script_path can be used in these cases to set the path of the currently executing R script manually.

Examples

Run this code
box::set_script_path('scripts/my_script.r')

Run the code above in your browser using DataLab