Crandore Hub

geohabnet

Geographical Risk Analysis Based on Habitat Connectivity

The 'geohabnet' package is designed to perform a geographically or spatially explicit risk analysis of habitat connectivity. Xing et al (2021) <doi:10.1093/biosci/biaa067> proposed the concept of cropland connectivity as a risk factor for plant pathogen or pest invasions. As the functions in 'geohabnet' were initially developed thinking on cropland connectivity, users are recommended to first be familiar with the concept by looking at the Xing et al paper. In a nutshell, a habitat connectivity analysis combines information from maps of host density, estimates the relative likelihood of pathogen movement between habitat locations in the area of interest, and applies network analysis to calculate the connectivity of habitat locations. The functions of 'geohabnet' are built to conduct a habitat connectivity analysis relying on geographic parameters (spatial resolution and spatial extent), dispersal parameters (in two commonly used dispersal kernels: inverse power law and negative exponential models), and network parameters (link weight thresholds and network metrics). The functionality and main extensions provided by the functions in 'geohabnet' to habitat connectivity analysis are a) Capability to easily calculate the connectivity of locations in a landscape using a single function, such as sensitivity_analysis() or msean(). b) As backbone datasets, the 'geohabnet' package supports the use of two publicly available global datasets to calculate cropland density. The backbone datasets in the 'geohabnet' package include crop distribution maps from Monfreda, C., N. Ramankutty, and J. A. Foley (2008) <doi:10.1029/2007gb002947> "Farming the planet: 2. Geographic distribution of crop areas, yields, physiological types, and net primary production in the year 2000, Global Biogeochem. Cycles, 22, GB1022" and International Food Policy Research Institute (2019) <doi:10.7910/DVN/PRFF8V> "Global Spatially-Disaggregated Crop Production Statistics Data for 2010 Version 2.0, Harvard Dataverse, V4". Users can also provide any other geographic dataset that represents host density. c) Because the 'geohabnet' package allows R users to provide maps of host density (as originally in Xing et al (2021)), host landscape density (representing the geographic distribution of either crops or wild species), or habitat distribution (such as host landscape density adjusted by climate suitability) as inputs, we propose the term habitat connectivity. d) The 'geohabnet' package allows R users to customize parameter values in the habitat connectivity analysis, facilitating context-specific (pathogen- or pest-specific) analyses. e) The 'geohabnet' package allows users to automatically visualize maps of the habitat connectivity of locations resulting from a sensitivity analysis across all customized parameter combinations. The primary functions are msean() and sensitivity analysis(). Most functions in 'geohabnet' provide three main outcomes: i) A map of mean habitat connectivity across parameters selected by the user, ii) a map of variance of habitat connectivity across the selected parameters, and iii) a map of the difference between the ranks of habitat connectivity and habitat density. Each function can be used to generate these maps as 'final' outcomes. Each function can also provide intermediate outcomes, such as the adjacency matrices built to perform the analysis, which can be used in other network analysis. Refer to article at <https://garrettlab.github.io/HabitatConnectivity/articles/analysis.html> to see examples of each function and how to access each of these outcome types. To change parameter values, the file called 'parameters.yaml' stores the parameters and their values, can be accessed using 'get_parameters()' and set new parameter values with 'set_parameters()'. Users can modify up to ten parameters.

README

<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- badges: start -->

[<img
src="https://github.com/GarrettLab/HabitatConnectivity/actions/workflows/pages/pages-build-deployment/badge.svg?branch=main"
width="250" height="25" alt="Github Pages" />](https://github.com/GarrettLab/HabitatConnectivity/actions/workflows/pages/pages-build-deployment)
[<img src="https://www.r-pkg.org/badges/version/geohabnet" width="100"
height="25" alt="CRAN status" />](https://CRAN.R-project.org/package=geohabnet)

<!-- badges: end -->

# geohabnet

This package expands on Xing et al (2021) <doi:10.1093/biosci/biaa067>.
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.

## Installation

Package can either be installed from CRAN:

``` r
install.packages("geohabnet")
#> Installing package into '/private/var/folders/r5/zggvft9d3yn5kh51wqp78rd00000gn/T/Rtmpk04dwi/temp_libpath644e7beb8e10'
#> (as 'lib' is unspecified)
#> Warning: package 'geohabnet' is not available for this version of R
#> 
#> A version of this package for your version of R might be available elsewhere,
#> see the ideas at
#> https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
```

or the source version of package can be installed from
[GitHub](https://github.com/GarrettLab/HabitatConnectivity/) with:

``` r
if (!require("devtools")) {
  install.packages("devtools")
}

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

## geohabnet Example

``` r
library(geohabnet)

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

Run the analysis using -

``` r
geohabnet::sensitivity_analysis()
```

`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*](https://garrettlab.github.io/HabitatConnectivity/articles/analysis.html)
for more elaborate description and usages of functions in this package.

Versions across snapshots

VersionRepositoryFileSize
2.2 rolling linux/jammy R-4.5 geohabnet_2.2.tar.gz 726.3 KiB
2.2 rolling linux/noble R-4.5 geohabnet_2.2.tar.gz 726.3 KiB
2.2 rolling source/ R- geohabnet_2.2.tar.gz 726.3 KiB
2.2 latest linux/jammy R-4.5 geohabnet_2.2.tar.gz 726.3 KiB
2.2 latest linux/noble R-4.5 geohabnet_2.2.tar.gz 726.3 KiB
2.2 latest source/ R- geohabnet_2.2.tar.gz 726.3 KiB
2.2 2026-04-26 source/ R- geohabnet_2.2.tar.gz 726.3 KiB
2.2 2026-04-23 source/ R- geohabnet_2.2.tar.gz 726.3 KiB
2.2 2026-04-09 windows/windows R-4.5 geohabnet_2.2.zip 996.2 KiB

Dependencies (latest)

Imports

Suggests