Creates a presence-absence matrix (PAM) from a data.frame that contains species names and identifiers of positions where species are found.
Arguments
- data
data.frame of species found in distinct positions (defined by identifiers). Must include at least two columns: "ID" and "Species".
- ID_column
(character) name of the column containing identifiers.
- species_column
(character) name of the column containing species names.
Examples
# Data
data("sp_data", package = "biosurvey")
# PAM
pam <- PAM_from_table(data = sp_data, ID_column = "ID",
species_column = "Species")
pam[1:10, c(1, 21:25)]
#> ID Species_20 Species_21 Species_22 Species_23 Species_24
#> 5 5 0 0 1 0 0
#> 35 35 0 1 0 0 0
#> 36 36 0 1 0 0 0
#> 38 38 0 0 1 0 0
#> 39 39 0 0 1 0 0
#> 40 40 0 0 1 0 0
#> 41 41 0 0 1 0 0
#> 42 42 0 0 1 0 0
#> 43 43 0 0 1 0 0
#> 44 44 0 0 1 0 0