Learn R Programming

spatsurv (version 2.0)

allocate: allocate function

Description

A function to allocate coordinates to an observation whose spatial location is known to the regional level

Usage

allocate(poly, popden, survdat, pid, sid, n = 2, wid = 2000)

Value

matrices x and y, both of size (number of observations in survdat x n) giving n potential candidate locations of points in the columns of x and y.

Arguments

poly

a SpatialPolygonsDataFrame, on which the survival data exist in aggregate form

popden

a sub-polygon raster image of population density

survdat

data.frame containing the survival data

pid

name of the variable in the survival data that gives the region identifier in poly

sid

the name of the variable in poly to match the region identifier in survdat to

n

the number of different allocations to make. e.g. if n is 2 (the default) two candidate sets of locations are available.

wid

The default is 2000, interpreted in metres ie 2Km. size of buffer to add to window for raster cropping purposes: this ensures that for each polygon, the cropped raster covers it completely.