Learn R Programming

whitebox (version 2.1.0)

wbt_init: Initialize WhiteboxTools

Description

wbt_init(): Check if a suitable WhiteboxTools executable is present. Search default path in package directory or set it manually with exe_path.

wbt_options(): Get/set package options

  • whitebox.exe_path - character. Path to executable file. The default value is the package installation directory, subdirectory "WBT", followed by whitebox_tools.exe or whitebox_tools. Set the whitebox.exe_path option using wbt_init() exe_path argument

  • whitebox.wd - character. Path to WhiteboxTools working directory. Used as --wd argument for tools that support it when wd is not specified elsewhere.

  • whitebox.verbose - logical. Should standard output from calls to executable be cat() out for readability? Default is result of interactive(). Individual tools may have verbose_mode setting that produce only single-line output when FALSE. These argument values are left as the defaults defined in the package documentation for that function. When whitebox.verbose=FALSE no output is produced. Set the value of whitebox.verbose with wbt_verbose() verbose argument.

wbt_wd(): Get or Set the WhiteboxTools working directory

wbt_verbose(): Check verbose options for WhiteboxTools

Usage

wbt_init(exe_path = wbt_exe_path(shell_quote = FALSE), ...)

wbt_options(exe_path = NULL, wd = NULL, verbose = NULL)

wbt_wd(wd = NULL)

wbt_verbose(verbose = NULL)

Arguments

exe_path

Default exe_path is result of wbt_exe_path() which checks a few user-settable options before defaulting to the package installation directory sub-directory "WBT". May be overridden if a custom path is needed.

...

additional arguments to wbt_options()

wd

character; Default: NULL; if set the package option whitebox.wd is set specified path (if directory exists)

verbose

Default: NULL; if logical, set the package option whitebox.verbose to specified value

Value

wbt_init(): logical; TRUE if binary file is found at exe_path

wbt_options(): an invisible list containing current whitebox.exe_path, whitebox.verbose options

wbt_wd(): character; when working directory is unset, will not add --wd= arguments to calls and should be the same as using getwd(). See Details.

wbt_verbose(): logical; defaults to result of interactive()

Details

wbt_wd(): Before you set the working directory in a session the default output will be in your current R working directory unless otherwise specified. You can change working directory at any time by setting the wd argument to wbt_wd() and running a tool. Note that once you have set a working directory, the directory needs to be set somewhere to "replace" the old value; just dropping the flag will not change the working directory back to the R working directory. To "unset" the option in the R package you can use wbt_wd("") which is equivalent to wbt_wd(getwd()).

See Also

install_whitebox() whitebox

Examples

Run this code
# NOT RUN {
## wbt_init():

# or set path to binary as an argument
# wbt_init(exe_path = "not/a/valid/path/whitebox_tools.exe")
# }
# NOT RUN {
## wbt_options():

# set multiple options (e.g. exe_path and verbose) with wbt_options()
wbt_options(exe_path = "not/a/valid/path/whitebox_tools.exe", verbose = TRUE)

# }
# NOT RUN {
## wbt_wd():

# set WBT working directory to R working directory
wbt_wd(wd = getwd())
# }
# NOT RUN {
## wbt_verbose():

wbt_verbose(verbose = TRUE)
# }

Run the code above in your browser using DataLab