Skip to content

Commit

Permalink
Update functions and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
8Ginette8 committed Jun 26, 2024
1 parent fbd1cf6 commit 84fa75a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
16 changes: 9 additions & 7 deletions R/get_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
#' @param bioreg 'SpatialPolygonsDataFrame', 'SpatVector' or 'sf' object containg different
#' ecoregions (convex hulls will be classified on a bioreg basis) and of CRS WGS84. Note
#' that this parameter may be fed with an external, generated (function make_ecoregion) or
#' in-house ecoregion shapefile. Four shapefiles can be downloaded with the library (function get_bioreg
#' in-house ecoregion shapefile. Four shapefiles can be downloaded with the library (see functions get_bioreg
#' and others): eco_terra' (for terrestrial species; Nature conservancy version adapted from Olson & al. 2001),
#' 'eco_marine' and 'eco_hd_marine' (for marine species; Spalding & al. 2007, 2012) and 'eco_fresh' (for freshwater
#' species; Abell & al. 2008). For marine species, 'eco_terra' may also be used if the user wants to represent
#' the terrestrial range of species that also partially settle on mainland. For fresh water species, same may be
#' done if the user considers that terrestrial ecoregions should be more representative of the species ecology.
#' @param bioreg_name Character. How is the shapefile attribute containing the ecoregion names called?
#' E.g., very detailed level of 'eco_terra' is 'ECO_NAME'. Note that 'EcoRegion' (default) must always be supplied when
#' using a make_ecoregion() output. See details.
#' @param bioreg_name Character. One ecoregion level/category name from the 'bioreg' polygon must be supplied.
#' E.g., very detailed level of 'eco_terra' is 'ECO_NAME'. Note that default applies if a make_ecoregion()
#' polygon is provided as 'bioreg'.
#' @param degrees_outlier Numeric. Distance threshold (degrees) for outlier classification.
#' If the nearest minimal distance to the next point is larger than this threshold, it will be
#' considered as an outlier.
Expand Down Expand Up @@ -123,7 +123,7 @@
get_range <- function (sp_name = NULL,
occ_coord = NULL,
bioreg = NULL,
bioreg_name = "EcoRegion",
bioreg_name = NULL,
degrees_outlier = 3,
clustered_points_outlier = 2,
buffer_width_point = 4,
Expand All @@ -138,9 +138,11 @@ get_range <- function (sp_name = NULL,
### =========================================================================

# bioreg
if (names(bioreg)[1]%in%"CLARA") {
bioreg_name = "EcoRegion"
}
if (methods::is(bioreg_name,"NULL")) {
stop("An ecoregion polygon should be supplied; if unavailable see command 'bioreg_list' and
internal functions get_bioreg(), read_bioreg() and check_and_get_bioreg()")
stop("Name of the desired ecoregion level/category ('bioreg_name' parameter) is missing, please provide one...")
}

# occ_coord
Expand Down
10 changes: 5 additions & 5 deletions man/get_range.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 84fa75a

Please sign in to comment.