Learn R Programming

fossil (version 0.4.0)

create.matrix: Creating species locality matrices

Description

Create a matrix with taxa as rows and occurrences or samples as columns

Usage

create.matrix(
  x,
  tax.name="genus",
  locality="locality",
  time.col=NULL,
  time=NULL, 
  abund=FALSE,
  abund.col="abundance"
)

Arguments

x

a table arranged in columnar format, with at least one column indicating name of taxa and another giving location or sample

tax.name

the name or number of the column giving the taxonomic names to be used (the rows of the matrix to be created)

locality

the name or number of the column giving the locations of the samples (the columns of the matrix to be created)

time.col

what is the column name or number containing the time periods; if left null, filtering for time willbe ignored

time

what time periods to keep for the matrix; if left null, filtering for time willbe ignored

abund

whether to record abundances of taxa; if left FALSE, a binary (presence/absence) matrix is created

abund.col

column name or number containing abundance values

Value

A matrix of taxa (rows) by localities (columns).

Details

This is a helper function to convert large lists of data into matrices of species (rows) and locations (columns). The parameters can be adjusted to create either a binary (presence/absence) or abundance matrix. The setup of the table is largely flexible; simply input the column names or numbers containing the pertinent information. To filter data according to time, both the time column and the time period must be specified. For abundance, the default title for the abundance column is simply "abundance"; the function will not work if you have chosen to include abundances (abund = TRUE but the name of the abundance column is incorrect.

See Also

create.lats

Examples

Run this code
# NOT RUN {
#converting the fdata.list dataset into a matrix of species (rows) 
#by samples (columns) with abundance data
data(fdata.list)
create.matrix(fdata.list, tax.name = "species", abund=TRUE)

#same data set, but now for an occurrence matrix
create.matrix(fdata.list, tax.name = "species", locality = "locality")

# }

Run the code above in your browser using DataLab