In addition to the Python interface, the WhiteboxTools library is also accessible from an R language package. R is a common programming language used within the statistical and scientific computing communities and the R WhiteboxTools package targets these groups. Prof. Qiusheng Wu, at Binghamton University (SUNY) maintains the R package.
WhiteboxTools is available on R-Forge and can be installed with the command:
You can alternatively install the development version of the R package whitebox from the GitHub repository as follows:
if (!require(devtools)) install.packages('devtools') devtools::install_github("giswqs/whiteboxR")
You will also need to make sure your machine is able to build packages from source. See Package Development Prerequisites for the tools needed for your operating system.
A complete list of functions available in the whitebox R package can be found within the GitHub repository. A comprehensive demonstration, complete with detailed examples, is also available from this site.
library(whitebox) # Prints the whitebox-tools help...a listing of available commands print(wbt_help()) # Prints the whitebox-tools license print(wbt_license()) # Prints the whitebox-tools version print(wbt_version()) # Prints the toolbox for a specific tool. print(wbt_toolbox()) # List all available tools in whitebox-tools print(wbt_list_tools()) # Lists tools with 'lidar' in tool name or description. print(wbt_list_tools("lidar")) # Prints the help for a specific tool. print(wbt_tool_help("lidar_info")) # Retrieves the tool parameter descriptions for a specific tool. print(wbt_tool_parameters("slope")) # View the source code for a specific tool on the source code repository. print(wbt_view_code("breach_depressions"))
Tool names in the whitebox R package can be called using the snake_case (e.g. lidar_info). A comprehensive list of all available function tools can be found on the package repository site. For example:
library(whitebox) # Set input raster DEM file dem <- system.file("extdata", "DEM.tif", package="whitebox") # Run tools feature_preserving_denoise(dem, "./smoothed.tif", filter=9) breach_depressions("./smoothed.tif", "./breached.tif") d_inf_flow_accumulation(dem, "./flow_accum.tif", verbose_mode=FALSE)