Convert a raster bird distribution into its flattened, vector equivalent
Source:R/flatten_raster.R
flatten_raster.Rd
This function converts between a raster representation of data in which rows and columns indicate position in space and a vector representation that contains only the active (not masked) cells in row major order - starting at the top left and proceeding left to right along each row. The collapsed form is used for projecting the flow model while the expanded form is used to export, import, and visualize the data.
Value
Either a vector representing a single distribution in its collapsed
form or, if x
represents multiple distributions, a matrix with one
distribution per column.
See also
expand_distr()
does the opposite offlatten_raster()
.rasterize_distr()
has replaced this function in the public API. Withformat = "numeric"
it returns an identical object toexpand_distr()
but by default (`format = "SpatRaster" it goes one step further and adds spatial metadata to make a terra::SpatRaster.index_conversions for ways to convert among indexes of the data in raster row and column, index along the flattened vector, and Cartesian space.