splist2presabs: Convert a species list to a presence-absence table
Description
This function takes a locality+species dataset in long (stacked) format, i.e., a matrix or data frame containing localities in one column and their recorded species in another column, and converts them to a presence-absence table (wide format) suitable for mapping and for computing distributional similarities (see e.g. simMat). Try out the Examples below for an illustration).
a matrix or data frame with localities in one column and species in another column. Type or paste 'data(rotifers); head(rotifers)' (without the quote marks) in the R console for an example.
sites.col
the name or index number of the column containing the localities in 'data'.
sp.col
the name or index number of the column containing the species names or codes in 'data'.
keep.n
logical value indicating whether to get in the resulting table the number of times each species appears in each locality; if FALSE (the default), only presence (1) or absence (0) is recorded.
Value
A data frame containing the localities in the first column and then one column per species indicating their presence or absence (or their number of records if keep.n = TRUE). Type 'data(rotif.env);
head(rotif.env[,18:47])' (without the quote marks) in the R console for an example.