R/is_sensitive_at.R

Defines functions is_sensitive_at

Documented in is_sensitive_at

#' Calculate sensitivity from  a sdc_raster at x,y locations.
#'
#' Calculate sensitivity from  a sdc_raster at x,y locations.
#' A typical use is to calculate the sensitivity for each of the locations `x`
#' was created with (see example).
#' @param x [sdc_raster()]
#' @param xy matrix of x and y coordinates, or a SpatialPoints or
#' SpatialPointsDataFrame object
#' @inheritDotParams is_sensitive
#' @return `logical` vector with
#' @example ./example/is_sensitive_at.R
#' @family sensitive
#' @export
is_sensitive_at <- function(x, xy, ...){
  assert_sdc_raster(x)
  sens <- is_sensitive(x, ...)
  as.logical(raster::extract(sens, xy))
  # cell <- raster::cellFromXY(sens, xy)
  # sens[cell]
}

Try the sdcSpatial package in your browser

Any scripts or data that you put into this service are public.

sdcSpatial documentation built on March 24, 2022, 5:05 p.m.