Builds a presence–absence matrix (PAM) in a two-dimensional **trait space**, by binning species occurrences along two quantitative attributes (e.g., body size and mass). Each species can have one or multiple entries in the trait dataset.
Arguments
- x
A data frame where the first column contains species (character vector), and the next two columns contain numeric trait values (2D space).
- n_bins
Integer. Number of bins per axis (default = 10).
- remove.cells
Logical. If `TRUE`, remove empty cells from the PAM (default).
- remove.sp
Logical. If `TRUE`, remove species absent from all cells (default).
- count
Logical. If `TRUE`, display a text progress bar while building the PAM.
Value
A list with two components:
PAM_attribute
: a matrix with cell ID, trait coordinates, and species presence (0/1).Attr_Richness_Raster
: a raster of richness (number of species) in trait space.