rij_matrix: Feature by planning unit matrix

Description Usage Arguments Details Value See Also Examples

Description

Generate a feature by planning unit (aka rij matrix) using spatial data sets. The rij contains data on the amount of each feature in each planning unit.

Usage

1
2
3
rij_matrix(x, y, ...) # x=Raster, y=Raster

rij_matrix(x, y, ...) # x=Spatial, y=Raster

Arguments

x

RasterLayer-class or Spatial-class object representing the planning units

y

Raster-class object representing the features

...

additional arguments passed to fast_extract if argument to x inherits from a Spatial-class object.

Details

The sparse matrix represents the spatial intersection between the planning units and the features. Rows correspond to planning units, and columns correspond to features. Values correspond to the amount of the feature in the planning unit. For example, the amount of the third species in the second planning unit would be contained in the cell in the third column and in the second column.

This function can take a long to run for big data sets. To reduce processing time, the set_number_of_threads function can be used to allocate more computational resources. Additionally, dealing with planning units represented with SpatialPolygonsDataFrame object, the velox package can be installed to reduce processing time.

Generally, processing Spatial-class data takes much longer to process then Raster-class data, and so it is recomended to use Raster-class data for planning units where possible.

Value

Matrix{dgCMatrix-class} object.

See Also

set_number_of_threads, velox.

Examples

1
2
3
4
5
6
7
8
# load data
data(sim_pu_raster, sim_pu_polygons)

# create rij matrix using raster planning units
rij_raster <- rij_matrix(sim_pu_raster, sim_features)

# create rij matrix using polygon planning units
rij_polygons <- rij_matrix(sim_pu_polygons, sim_features)

prioritizr/prioritizrutils documentation built on May 25, 2019, 12:20 p.m.