Learn R Programming

stratigraph (version 0.66)

compress2matrix: Converts compressed format files to flat matrices

Description

Reads 'compressed format' text files giving the species found at particular sites and rewrite them into a sites by species matrix.

Usage

compress2matrix(path, skip = 3, verbose = TRUE, lump.queries = FALSE, exclude.taxa = NULL)

Arguments

path
the directory within which to process all the files that end in '.BB' (which must be capitalized).
skip
skip is the number of lines to skip at the beginning of each file, defaulting to 3.
verbose
verbose = TRUE (the default) prints diagnostic messages.
lump.queries
lump.queries = TRUE treats taxon names/codes that are followed by question marks as if they were the same as the same name/code not followed by a question mark. FALSE (the default) treats queries as separate taxa.
exclude.taxa
character vector giving taxon names to exclude.

Value

The return value of the function is a list including a vector of site names, a vector of taxon names/codes, and a sites-by-species matrix. As a side-product, the function saves (in the directory specified by path) a matrix (tab-delimited text file ending in .MTX) for each locality (.BB file) and the overall sites-by-species matrix as a file named 'SiteBySpp.MTX'.

Details

Compressed format data has a line of data for each site consisting of tab-separated records, the first two records give the site name; the remaining records are pairs separated by a single space giving species names and counts (species names can be repeated).

See Also

plot.strat.column, stratigraph