binarize_and_aggregate: Binarize a categorical raster and optionally aggregate

View source: R/binarize_and_aggregate.R

binarize_and_aggregateR Documentation

Binarize a categorical raster and optionally aggregate

Description

Binarize a categorical raster and optionally aggregate and/or resample.

Usage

binarize_and_aggregate(
  infile,
  rle,
  outfile,
  extent,
  res,
  categories,
  overwrite = FALSE,
  return_rast = FALSE,
  quiet = FALSE
)

Arguments

infile

Character. File path to a categorical raster. If rle is provided, infile must not be provided.

rle

A raster_rle object generated by rle_compress() or a file path to such an object saved as .rds.

outfile

Character. The target file path for the binarized raster.

extent

Output extent as an Extent object or an object from which an Extent object can be extracted. If not provided, extent will be taken from input. If extent differs from that of infile, new cells will be assigned value 1 if any original cells belonging to categories have their centroids within the new cell.

res

output resolution as a numeric vector of 1 or 2 elements, or a Raster* object from which resolution can be extracted. If not provided, resolution will be taken from input. If res differs from that of infile, new cells will be assigned value 1 if any original cells belonging to categories have their centroids within the new cell.

categories

Integer or numeric vector of class values to be laballed as 1 in the target raster.

overwrite

Logical. Should outfile be overwritten if it exists?

return_rast

Logical. Should the target raster be returned to R as a Raster layer (TRUE) or not returned (FALSE)?

quiet

Logical. Should progress messages be suppressed?

Value

A binarized raster layer is written to outfile, and if return_rast is TRUE, the raster is additionally returned to R as a Raster layer.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.