Convert continuous probability of use in each season to binary high use in any season or each season using thresholds given in a table.
calcBinaryUse(x, ...)
# S4 method for class 'CaribouHabitat'
calcBinaryUse(x, tholdTable = threshTable, bySeason = FALSE)
CaribouHabitat object where habitat use has been calculated, or a data.frame with columns PID, Spring, Summer, Fall, Winter, or a numeric vector containing ID values, in which case spring, summer, fall and winter must also be supplied
passed to methods
By default threshTable
which contains thresholds
determimed by Rempel (2021) using Youden's J and a false
negative cost of 5. Change at own risk.
logical. If FALSE (the default) the result is a single value of 1 when the habitat use was >= threshold in any season and 0 if not. If TRUE then the result is a 0 or 1 for each season.
If bySeason
is FALSE
and x
is a CaribouHabitat object then the result is 1 layer SpatRaster.
If bySeason
is TRUE
and x
is a CaribouHabitat object then the result is SpatRaster with a layer per season.
If bySeason
is FALSE
and x
is a data.frame then the result is a data.frame.
If bySeason
is TRUE
and x
is a data.frame then the result is a data.frame.
If bySeason
is FALSE
and x
is a vector then the result is a vector.
If bySeason
is TRUE
and x
is a vector then the result is a data.frame.
Caribou habitat functions:
CaribouHabitat-class
,
caribouHabitat()
,
coefTableHR
,
coefTableStd
,
fnlcToResType
,
loadSpatialInputs()
,
plcToResType
,
rasterizeLineDensity()
,
reclassPLC()
,
resTypeCode
,
results()
,
rfuToResType
,
threshTable
,
updateCaribou()
# create example rasters
lc <- terra::rast(xmin = 0, xmax = 25000, ymin = 0, ymax = 25000,
resolution = 250, crs = sf::st_crs(5070)$wkt)
lc[] <- 0
nd <- lc
nd[1:30, 1:30] <- 1
ad <- lc
ad[30:50, 3:50] <- 1
lc[] <- 1
lc[70:100, 70:100] <- 2
# create sf objects
lf <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 0, 10000, 10000),
ncol = 2, byrow = TRUE))),
crs = sf::st_crs(5070)))
esk <- sf::st_as_sf(sf::st_sfc(list(sf::st_linestring(matrix(c(0, 10000, 10000, 0),
ncol = 2, byrow = TRUE))),
crs = sf::st_crs(5070)))
projPol <- sf::st_sf(sf::st_as_sfc(sf::st_bbox(ad)))
projPol <- sf::st_set_crs(projPol, sf::st_crs(5070))
# calculate relative probability of use
res <- caribouHabitat(landCover = lc,
linFeat = lf,
esker = esk,
natDist = nd,
anthroDist = ad,
projectPoly = projPol,
caribouRange = "Nipigon",
winArea = 1000 #leave as default NULL except for small examples
)
#> cropping linFeat to extent of projectPoly
#> cropping esker to extent of projectPoly
#> Applying moving window.
if(interactive()){
plot(calcBinaryUse(res))
plot(calcBinaryUse(res, bySeason = TRUE))
}