Description Usage Arguments Value See Also Examples
Takes polygons, an occurrence dataset and covariates. Returns a data.frame
containing
centroid coordinates, count of occurrence points and a summary of covariate values for each polygon.
Includes an option to specify the function to apply across pixel values for each covariate.
The default is mean.
1 2 | sortPolyData(polygons, data, covariates, fun = rep("mean",
nlayers(covariates)))
|
polygons |
an object of |
data |
a |
covariates |
a |
fun |
vector of length equalling the number of covariates specifying the function to be applied across pixel values within each polygon for each covariate. The default is 'mean'. Functions must be entered as strings and 'modal' should be specified for discrete variables. |
A data.frame
of, for each polygon, centroid coordinates,
counts of occurrence points and a summary of covariate values.
Other GIS: bufferMask
, condSim
,
getArea
, getPoints
,
insertRaster
, ll2cart
,
makeVoronoiPolygons
, safeMask
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # load packages
library(sp)
library(raster)
library(seegSDM)
# make voronoi polygons
example(makeVoronoiPolygons)
# make occcurrence data
occ <- matrix(c(-5, 0,
-1, 6,
-8, 8,
-8, 7,
-5, 10),
ncol=2,
byrow=TRUE)
# convert to dataframe
occ <- as.data.frame(occ)
# add Longitude and Latitude columns
colnames(occ)[colnames(occ)=='V1'] <- 'Longitude'
colnames(occ)[colnames(occ)=='V2'] <- 'Latitude'
# load covariates from seegSDM
data(covariates)
# make functions vector
fun = c('mean', 'mean', 'modal')
# sort data
dat <- sortPolyData(polygons = v, data = occ, covariates=covariates, fun=fun)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.