Description Usage Arguments Details
Get a smoothed cover of a raster object. From all non-missing values of a raster object, a 2D kernal density is applied. The output is a sf
object of spatial polygons. Used by smooth_map
. Note that this function supports sf
objects, but still uses sp-based methods (see details). Note that this function supports sf
objects, but still uses sp-based methods (see details).
1 2 | smooth_raster_cover(shp, var = NULL, bandwidth = NA, threshold = 0.6,
output = "polygons")
|
shp |
raster object, from either |
var |
name of the variable from which missing values are flagged. If unspecified, the first variable will be taken. |
bandwidth |
single numeric value or vector of two numeric values that specifiy the bandwidth of the kernal density estimator. See details. |
threshold |
numeric value between 0 and 1 that determines which part of the estimated 2D kernal density is returned as cover. |
output |
class of the returned object. One of: |
For the estimation of the 2D kernal density, code is borrowed from bkde2D
. This implemention is slightly different: bkde2D
takes point coordinates and applies linear binning, whereas in this function, the data is already binned, with values 1 if the values of var
are not missing and 0 if values of var
are missing.
This function supports sf
objects, but still uses sp-based methods, from the packages sp, rgeos, and/or rgdal.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.