Github Pages CRAN status


This package expands on Xing et al (2021). It adds capabilities to customize parameter values using functions and shows the results of habitat connectivity risk index in the form of plots. The goal of geohabnet is to enable users to visualize a habitat connectivity risk index using their own parameter values. The risk analysis outputs 3 maps -

  1. Mean habitat connectivity (based on a habitat connectivity index defined by the user)

  2. Difference in habitat connectivity

  3. Variance in habitat connectivity

This package currently supports crop maps sourced from geodata::monfredaCrops() and geodata::spamCrops(). This analysis produces the 3 maps listed above. There are multiple ways in which functions can be used - generate the final outcome and then the intermediate outcomes for more sophisticated use cases. The vignettes provide several examples. The output values are propagated to other functions for performing operations such as distance matrix calculation. The values are set in parameters.yaml and it can be accessed using get_parameters(). See the usage below.


Package can either be installed from CRAN:

#> Installing package into '/private/var/folders/r5/zggvft9d3yn5kh51wqp78rd00000gn/T/RtmpBU77e3/temp_libpath4f5365f57439'
#> (as 'lib' is unspecified)
#> The downloaded binary packages are in
#>  /var/folders/r5/zggvft9d3yn5kh51wqp78rd00000gn/T//RtmpBqmkXl/downloaded_packages

or the source version of package can be installed from GitHub with:

if (!require("devtools")) {

devtools::install_github("GarrettLab/HabitatConnectivity", subdir = "geohabnet")

geohabnet Example


param_file <- geohabnet::get_parameters()
# now edit the file
geohabnet::set_parameters(new_params = param_file)

Run the analysis using -


parameters.yaml stores the parameter and its values. It can be accessed and set using get_parameters() and set_parameters() respectively. By default risk analysis is run on global index, for which scales are present in global_scales() .

Refer to help using ?geohabnet::fun or help(geohabnet::fun)

Refer to article Analyzing risk index using cropland connectivity for more elaborate description and usages of functions in this package.