| Title: | Boundary Overlap Statistics |
|---|---|
| Description: | Analysis workflow for finding geographic boundaries of ecological or landscape traits and comparing the placement of geographic boundaries of two traits. If data are trait values, trait data are transformed to boundary intensities based on approximate first derivatives across latitude and longitude. The package includes functions to create custom null models based on the input data. The boundary statistics are described in: Fortin, Drapeau, and Jacquez (1996) <doi:10.2307/3545584>. |
| Authors: | Amy Luo [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-9197-4673>), Elizabeth Derryberry [ths] (ORCID: <https://orcid.org/0000-0002-8248-9748>) |
| Maintainer: | Amy Luo <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.3.0 |
| Built: | 2026-05-20 07:31:24 UTC |
| Source: | https://github.com/aluo734/boundarystats |
Projection for A.delicatus_matrix
data(A.delicatus)data(A.delicatus)
Projection crs object
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Extent for A.delicatus_matrix
data(A.delicatus)data(A.delicatus)
Numeric vector of length length 4
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Raster data representing interpolated genetic group assignments for Afrixalus delicatus based on analyses in Barratt et al. 2018.
data(A.delicatus)data(A.delicatus)
A matrix to be converted into a SpatRaster object with a EPSG:4210 projection.
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Projection for A.sylvaticus_matrix
data(A.sylvaticus)data(A.sylvaticus)
Projection crs object
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Extent for A.sylvaticus_matrix
data(A.sylvaticus)data(A.sylvaticus)
Numeric vector of length length 4
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Raster data representing interpolated genetic group assignments for Afrixalus sylvaticus based on analyses in Barratt et al. 2018.
data(A.sylvaticus)data(A.sylvaticus)
A matrix to be converted into a SpatRaster object with a EPSG:4210 projection.
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Statistical test for the average minimum distance between boundary elements in two raster layers. Uses Euclidean distance. Boundaries for each trait affect one another reciprocally (x affects y and y affects x).
average_min_distance(x, y, null_distrib)average_min_distance(x, y, null_distrib)
x |
A SpatRaster object with boundary elements. |
y |
A SpatRaster object with boundary elements. |
null_distrib |
A list of probability functions output from overlap_null_distrib(). |
p-value
Amy Luo
Jacquez, G.M., Maruca,I S. & Fortin, M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241. Fortin, M.-J., Drapeau, P. & Jacquez, G.M. (1996) Quantification of the Spatial Co-Occurrences of Ecological Boundaries. Oikos, 77, 51-60.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) average_min_distance(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) average_min_distance(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Statistical test for the average minimum distance between each boundary element in raster x and the nearest boundary element in raster y. Uses Euclidean distance. The boundaries of trait x depend on the boundaries of trait y.
average_min_x_to_y(x, y, null_distrib)average_min_x_to_y(x, y, null_distrib)
x |
A SpatRaster object with boundary elements. |
y |
A SpatRaster object with boundary elements. |
null_distrib |
A list of probability functions output from overlap_null_distrib(). |
The average minimum distance and a p-value.
Amy Luo
Jacquez, G.M., Maruca,I S. & Fortin,M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241. Fortin, M.-J., Drapeau, P. & Jacquez, G.M. (1996) Quantification of the Spatial Co-Occurrences of Ecological Boundaries. Oikos, 77, 51-60.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) average_min_x_to_y(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) average_min_x_to_y(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Creates custom probability distributions for two boundary statistics (number of subgraphs and length of the longest subgraph). Given a SpatRaster object, simulates n iterations of random raster surfaces from a neutral model.
boundary_null_distrib( x, calculate_intensity = FALSE, cat = FALSE, threshold = 0.2, n_iterations = 10, model = "random", p = 0.5, progress = TRUE )boundary_null_distrib( x, calculate_intensity = FALSE, cat = FALSE, threshold = 0.2, n_iterations = 10, model = "random", p = 0.5, progress = TRUE )
x |
A SpatRaster object. |
calculate_intensity |
TRUE if x contains numeric trait data from which boundary intensities should be calculated. default = FALSE. |
cat |
TRUE if the input SpatRaster contains a categorical variable. default = FALSE. |
threshold |
A value between 0 and 1. The proportion of cells to keep as boundary elements. default = 0.2. |
n_iterations |
An integer indicating the number of iterations for the function. A value of 100 or 1000 is recommended to produce sufficient resolution for downstream statistical tests. default = 10. |
model |
Neutral model to use. Options: 'random' (stochastic), 'gaussian' (Gaussian random field), and 'random_cluster' (modified random clusters method) |
p |
If using modified random clusters, proportion of cells to be marked in percolated raster.Higher values of p produce larger clusters. Default: p = 0.5 |
progress |
If progress = TRUE (default) a progress bar will be displayed. |
A list of two probability distribution functions for boundary statistics.
Amy Luo
Saura, S. & Martínez-Millán, J. (2000). Landscape patterns simulation with a modified random clusters method. Landscape Ecology, 15:661-678.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster')data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster')
This function is deprecated. Please use define_boundary
Creates boundary element cells where patches of two categories meet.
categorical_boundary(x)categorical_boundary(x)
x |
A SpatRaster object. |
A SpatRaster object with cell values 1 for boundary elements and 0 for other cells
Amy Luo
data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext grassland_boundaries <- categorical_boundary(grassland)data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext grassland_boundaries <- categorical_boundary(grassland)
Defines boundary elements in a SpatRaster object.
For categorical traits, boundary elements are defined as cells that neighbor a patch with a different value.
If the trait is quantitative, function will keep a proportion of the cells with the highest boundary intensity values, with a threshold chosen by the user. If the SpatRaster contains trait values, boundary intensity values can be calculated (calculate_intensity = T) using a Sobel-Feldman operator.
In some cases, there may be many redundant values for boundary intensity. If the threshold is set to cut off the values at those points, the actual proportion of cells categorized as boundary elements would differ from the intended threshold. The function reports the proportion of cells that are boundary elements, so that users can choose a different value, if necessary.
define_boundary(x, cat = FALSE, threshold = 0.2, calculate_intensity = FALSE)define_boundary(x, cat = FALSE, threshold = 0.2, calculate_intensity = FALSE)
x |
A SpatRaster object. |
cat |
TRUE if the input SpatRaster contains a categorical variable. default = FALSE. |
threshold |
A value between 0 and 1. The proportion of cells to keep as boundary elements. default = 0.2. |
calculate_intensity |
logical. If TRUE, calculate boundary intensity at each cell from trait data. default = FALSE. |
A SpatRaster object with cell values 1 for boundary elements and 0 for other cells
Amy Luo
Fortin, M.J. et al. (2000) Issues related to the detection of boundaries. Landscape Ecology, 15, 453-466. Jacquez, G.M., Maruca,I S. & Fortin M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241.
data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext grassland_boundaries <- define_boundary(grassland, threshold = 0.1)data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext grassland_boundaries <- define_boundary(grassland, threshold = 0.1)
Projection for ecoregions_matrix
data(ecoregions)data(ecoregions)
Projection crs object
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Extent for ecoregions_matrix
data(ecoregions)data(ecoregions)
Numeric vector of length length 4
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Raster data of ecoregions in East Africa
data(ecoregions)data(ecoregions)
A matrix to be converted into a SpatRaster object with a EPSG:4210 projection.
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Simulates a gaussian random field as a neutral landscape of the same extent and resolution as the input raster, using the same spatial autocorrelation range as the input
gauss_random_field_sim(x, autocorr_range)gauss_random_field_sim(x, autocorr_range)
x |
A SpatRaster object. |
autocorr_range |
Distance range of spatial autocorrelation. |
A SpatRaster object with boundary elements.
Amy Luo
James, P. M. A., Fleming, R.A., & Fortin, M.-J. (2010) Identifying significant scale-specific spatial boundaries using wavelets and null models: Spruce budworm defoliation in Ontario, Canada as a case study. Landscape Ecology, 6, 873-887.
data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- gauss_random_field_sim(grassland, 3) terra::plot(simulation)data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- gauss_random_field_sim(grassland, 3) terra::plot(simulation)
Projection for grassland_matrix
data(grassland)data(grassland)
Projection crs object
Cox et al. (2023) Conservation Genetics Radoux et al. (2019) Remote Sens 11:354.
Extent for grassland_matrix
data(grassland)data(grassland)
Numeric vector of length length 4
Cox et al. (2023) Conservation Genetics Radoux et al. (2019) Remote Sens 11:354.
Raster land cover data from the LifeWatch Wallonia-Brussels ecotope database and used in Cox et al. 2023. Downsampled to match T. cristatus raster
data(grassland)data(grassland)
A matrix to be converted into a SpatRaster object with a EPSG:4326 projection.
Cox et al. (2023) Conservation Genetics Radoux et al. (2019) Remote Sens 11:354.
Projection
data(L.concolor)data(L.concolor)
Projection crs object
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Extent for L.concolor_matrix
data(L.concolor)data(L.concolor)
Numeric vector of length length 4
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Raster data representing interpolated genetic group assignments for Leptopelis concolor based on analyses in Barratt et al. 2018.
data(L.concolor)data(L.concolor)
A matrix to be converted into a SpatRaster object with a EPSG:4210 projection.
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Projection for L.flavomaculatus_matrix
data(L.flavomaculatus)data(L.flavomaculatus)
Projection crs object
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Extent for L.flavomaculatus_ext
data(L.flavomaculatus)data(L.flavomaculatus)
Numeric vector of length length 4
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Raster data representing interpolated genetic group assignments for Leptopelis flavomaculatus based on analyses in Barratt et al. 2018.
data(L.flavomaculatus)data(L.flavomaculatus)
A matrix to be converted into a SpatRaster object with a EPSG:4210 projection.
Barratt et al. (2013) Molecular Ecology 27:4289–4308
Statistical test for the length of the longest subgraph, or set of contiguous boundary elements.
longest_boundary(x, null_distrib)longest_boundary(x, null_distrib)
x |
A SpatRaster object with boundary elements. |
null_distrib |
A list of probability functions output from boundary_null_distrib(). |
The length of the longest subgraph and a p-value.
Amy Luo
Jacquez, G.M., Maruca,I S. & Fortin M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext Tcrist_boundaries <- define_boundary(T.cristatus, cat = FALSE) T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster') longest_boundary(Tcrist_boundaries, T.crist_bound_null)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext Tcrist_boundaries <- define_boundary(T.cristatus, cat = FALSE) T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster') longest_boundary(Tcrist_boundaries, T.crist_bound_null)
Simulates a neutral landscape of the same extent and resolution as the input raster, with the same distribution of values.
mod_random_clust_sim(x, p)mod_random_clust_sim(x, p)
x |
A SpatRaster object. |
p |
The proportion of cells to be marked in percolated raster. Higher values of p produce larger clusters. |
A SpatRaster object with boundary elements.
Amy Luo
Saura, S. & Martínez-Millán, J. (2000) Landscape patterns simulation with a modified random clusters method. Landscape Ecology, 15, 661 – 678.
data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- mod_random_clust_sim(grassland, p = 0.6) terra::plot(simulation)data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- mod_random_clust_sim(grassland, p = 0.6) terra::plot(simulation)
Statistical test the for number of subgraphs, or sets of contiguous boundary elements, in the data.
n_boundaries(x, null_distrib)n_boundaries(x, null_distrib)
x |
A SpatRaster object with boundary elements. |
null_distrib |
A list of probability functions output from boundary_null_distrib(). |
The number of subgraphs in the raster and a p-value.
Amy Luo
Jacquez, G.M., Maruca,I S. & Fortin M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext T.crist_boundaries <- define_boundary(T.cristatus, cat = TRUE) T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster') n_boundaries(T.crist_boundaries, T.crist_bound_null)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext T.crist_boundaries <- define_boundary(T.cristatus, cat = TRUE) T.crist_bound_null <- boundary_null_distrib(T.cristatus, cat = TRUE, n_iterations = 100, model = 'random_cluster') n_boundaries(T.crist_boundaries, T.crist_bound_null)
Statistical test for the number of directly overlapping boundary elements of two traits.
n_overlap_boundaries(x, y, null_distrib)n_overlap_boundaries(x, y, null_distrib)
x |
A SpatRaster object with boundary elements. |
y |
A SpatRaster object with boundary elements. |
null_distrib |
A list of probability functions output from overlap_null_distrib(). |
The number of directly overlapping boundary elements and a p-value.
Amy Luo
Jacquez, G.M., Maruca,I S. & Fortin, M.-J. (2000) From fields to objects: A review of geographic boundary analysis. Journal of Geographical Systems, 3, 221, 241. Fortin, M.-J., Drapeau, P. & Jacquez, G.M. (1996) Quantification of the Spatial Co-Occurrences of Ecological Boundaries. Oikos, 77, 51-60.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) n_overlap_boundaries(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster') Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, cat = FALSE, threshold = 0.1) n_overlap_boundaries(Tcrist_boundaries, grassland_boundaries, Tcrist_ovlp_null)
Creates custom probability distributions for three boundary overlap statistics (directly overlapping boundary elements, minimum distance between boundary elements in x to y, and minimum distance between elements in x and y). Given two SpatRaster objects with the same extent, projection, and resolution, simulates n iterations of random raster surfaces from neutral model(s).
overlap_null_distrib( x, y, rand_both, x_calculate_intensity = FALSE, y_calculate_intensity = FALSE, x_cat = FALSE, y_cat = FALSE, threshold = 0.2, n_iterations = 10, x_model = "random", y_model = "random", px = 0.5, py = 0.5, progress = TRUE )overlap_null_distrib( x, y, rand_both, x_calculate_intensity = FALSE, y_calculate_intensity = FALSE, x_cat = FALSE, y_cat = FALSE, threshold = 0.2, n_iterations = 10, x_model = "random", y_model = "random", px = 0.5, py = 0.5, progress = TRUE )
x |
A SpatRaster object. If rand_both = FALSE, only this raster will be modeled. |
y |
A SpatRaster object. If rand_both = FALSE, this raster does not change. |
rand_both |
TRUE if distribution of traits in x and y should be modeled. |
x_calculate_intensity |
TRUE if x contains numeric trait data from which boundary intensities should be calculated. default = FALSE. |
y_calculate_intensity |
TRUE if y contains numeric trait data from which boundary intensities should be calculated. default = FALSE. |
x_cat |
TRUE if x contains a categorical variable. default = FALSE. |
y_cat |
TRUE if y contains a categorical variable. default = FALSE. |
threshold |
A value between 0 and 1. The proportion of cells to keep as boundary elements. Default = 0.2. |
n_iterations |
An integer indicating the number of iterations for the function. A value of 100 or 1000 is recommended to produce sufficient resolution for downstream statistical tests. default = 10. |
x_model |
Neutral model to use. Options: 'random' (stochastic), 'gaussian' (Gaussian random field), and 'random_cluster' (modified random clusters method) |
y_model |
Neutral model to use for y. |
px |
If using modified random clusters for x, proportion of cells to be marked in percolated raster. Higher values of p produce larger clusters. Default = 0.5 |
py |
If using modified random clusters for y, proportion of cells to be marked in percolated raster. Higher values of p produce larger clusters. Default = 0.5 |
progress |
If progress = TRUE (default) a progress bar will be displayed. |
A list of probability distribution functions for boundary overlap statistics.
Amy Luo
Saura, S. & Martínez-Millán, J. (2000). Landscape patterns simulation with a modified random clusters method. Landscape Ecology, 15:661-678.
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster')data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_ovlp_null <- overlap_null_distrib(T.cristatus, grassland, rand_both = FALSE, x_cat = TRUE, n_iterations = 100, x_model = 'random_cluster')
This is a wrapper function for ggplot2 that will produce a map of boundary elements for two traits and show where boundary elements intersect.
plot_boundary(x, y, color = NA, trait_names = NA, output_raster = FALSE)plot_boundary(x, y, color = NA, trait_names = NA, output_raster = FALSE)
x |
A SpatRaster object with boundary elements. |
y |
A SpatRaster object with boundary elements. |
color |
Optional. A character vector of up to three colors (x boundary, y boundary, and overlapping elements). |
trait_names |
Optional. A character vector with up to two elements (legend name for x and legend name for y). |
output_raster |
Returns a SpatRaster object with the boundary elements of each trait and overlapping boundary elements together in a single layer. |
A ggplot2 object.
Amy Luo
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, threshold = 0.1) plot_boundary(Tcrist_boundaries, grassland_boundaries)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext Tcrist_boundaries <- define_boundary(T.cristatus, cat = TRUE) grassland_boundaries <- define_boundary(grassland, threshold = 0.1) plot_boundary(Tcrist_boundaries, grassland_boundaries)
Simulates a spatially stochastic neutral landscape of the same extent and resolution as the input raster, with the same distribution of values.
random_raster_sim(x)random_raster_sim(x)
x |
A SpatRaster object. |
A SpatRaster object with boundary elements.
Amy Luo
James, P. M. A., Fleming, R.A., & Fortin, M.-J. (2010) Identifying significant scale-specific spatial boundaries using wavelets and null models: Spruce budworm defoliation in Ontario, Canada as a case study. Landscape Ecology, 6, 873-887.
data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- random_raster_sim(grassland) terra::plot(simulation)data(grassland) grassland <- terra::rast(grassland_matrix, crs = grassland_crs) terra::ext(grassland) <- grassland_ext simulation <- random_raster_sim(grassland) terra::plot(simulation)
Uses a Sobel-Feldman operator (3x3 kernel) to detect internal edges in a SpatRaster object.
sobel_operator(x)sobel_operator(x)
x |
A SpatRaster object. |
A SpatRaster object with boundary values.
Amy Luo
data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext edges <- sobel_operator(T.cristatus) terra::plot(edges)data(T.cristatus) T.cristatus <- terra::rast(T.cristatus_matrix, crs = T.cristatus_crs) terra::ext(T.cristatus) <- T.cristatus_ext edges <- sobel_operator(T.cristatus) terra::plot(edges)
Projection for T.cristatus_matrix
data(T.cristatus)data(T.cristatus)
ces Barratt et al. (2013) Molecular Ecology 27:4289–4308
Projection crs object
Cox et al. (2023) Conservation Genetics
Extent for T.cristatus_matrix
data(T.cristatus)data(T.cristatus)
Numeric vector of length length 4
Cox et al. (2023) Conservation Genetics
Raster data representing interpolated genetic group assignments for Triturus cristatus based on analyses in Cox et al. 2023
data(T.cristatus)data(T.cristatus)
A matrix to be converted into a SpatRaster object with a EPSG:4326 projection.
Cox et al. (2023) Conservation Genetics