Create a presence/absence object
Create a presence/absence (pa
) object from a matrix.
Source: R/ec_pa.R
ec_pa.Rd
Create a presence/absence object
Create a presence/absence (pa
) object from a matrix.
Arguments
- x
a R object to be coerced as a matrix.
- threshold
threshold value. Above (strictly) this value, a species is considered present.
- spc_name
vector of species names.
- sit_name
vector of site names.
Details
The input x
should be a presence absence matrix (sites as rows and species as columns), it could be either a logical one or a numeric one. In the latter case, presence and absence will be determined based on threshold
.
If there are less names than species (or sites), or no names at all, then names will be automatically added. These names are created using column or row numbers (zero-padded to the number of digits of total the number of column or row), preceded by spc_
for column and sit_
for sites.
Examples
ec_pa(matrix(c(0, 0, 0, 1, 1, 0, 1, 0, 0), 3, 3), spc_name = "Lynx", sit_name = "ON_001")
#> ℹ Less names than sites, names have been generated.
#> ℹ Less names than species, names have been generated.
#> ! No presence data for the following species: 1
#> ! Empty site(s): 3
#> ℹ Presence absence matrix: 3 sites, 3 species, 3 occurrences.
#> Lynx spc_2 spc_3
#> ON_001 0 1 1
#> sit_2 0 1 0
#> sit_3 0 0 0