Description Usage Arguments Details Value Note Author(s) See Also Examples
Function SpeciesTaxonomy
accepts local R
objects (arguments x
and y
) or csv-files (file.x
and file.y
) as inputs. All meaningful combinations (e. g. x
and file.y
) are supported and each argument is coerced to it's corresponding class. Argument x
is initialized as class Species
and y
as class Taxonomy
, including basic data integrity checking for the respective class. The function further checks if the abbreviation in x
(class Species
with column 'abbr'
) matches those in y
(class Taxonomy
, itself with column 'abbr'
). Any mismatches are printed on screen, and possibly no object is returned if serious deviations where identified.
1 2 |
x |
|
y |
as above but conforming to the specifications
of class |
file.x |
path to a csv-file having species abundances in long format as defined by
|
file.y |
as above but giving a taxonomic reference list as defined by
|
sep, dec |
separators and decimals in input file, see |
pmatch |
use |
skip |
retain only mandatory columns, defaults to |
verbose |
prints diagnostic messages. |
... |
currently not used. |
Of course, the column 'abbr'
in the taxonomic reference has to be
unique. Not only because it is used as rownames, but also as to reference a
scientific name to only one abbreviation.
Classes Species
and Taxonomy
allow more columns than the default and mandatory ones. If argument
skip = TRUE
all non necessary columns will be skipped and the
minimal set of columns is retained. Set skip
to TRUE
if you
wish to keep the information of additional columns.
If an abbreviation used in the object representing species observations
(class 'Species'
) is not found in the reference (class
'Taxonomy'
), and vice-versa, the function stops and a
'data.frame'
including all ambiguities is returned. If argument
pmatch = TRUE
partial matches are treated as correct
(see pmatch). Proceed with fingers crossed! Never the less,
if you are happy with what pmatch
found and you want to use these
matches to override your raw data, you might think about saving the object
returned from SpeciesTaxonomy(...)
to disk and run the function again
on these modified objects. If there are any matching errors or ambiguities
it is highly advisable, however, to review the data and apply corrections
manually to the raw data where necessary.
An object of class SpeciesTaxonomy
with slots of class
Species
and Taxonomy
.
Integrity of the taxonomic reference list is crucial to build an object of
class "SpeciesTaxonomy"
and function Vegsoup
also relies on
it. If it's necessary to replace several abbreviations it is handy to save
write.table(taxonomy(obj), "foo.txt", quote = FALSE, row.names = FALSE)
to create an object suitable for automatic replacement.
Roland Kaiser
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | require(vegsoup)
require(vegan)
# an example using the dune data set supplied with package 'vegan'
data(dune)
# prepare and create species data
# there are two moss species in the dune data set, see vector of taxon names below
# we assign bryophytes to a moos layer ('ml') vascular palnts to herb layer ('hl')
x <- data.frame(abbr = names(dune),
layer = c(rep("hl", 8), "ml", rep("hl", 6), "ml", rep("hl", 14)),
taxon = "", t(dune))
# groom plot names
names(x)[4:ncol(x)] <- gsub("X", "dn", names(x)[4:ncol(x)])
# promote to class 'Species'
( s <- stackSpecies(x) )
# build taxonomic reference list from scratch
# these are the scientific names corresponding to the abbreviations in dune
# as I understand it
taxon <- c("Bellis perennis", "Leontodon autumnalis", "Poa pratensis",
"Trifolium repens", "Achillea millefolium", "Poa trivialis",
"Elymus repens", "Lolium perenne", "Alopecuros geniculatuis",
"Bormus hordeaceus", "Juncus bufonius", "Ranunculus flammula",
"Cheopodium album", "Sagina procumbens", "Agrostis stolonifera",
"Brachytethium rutabulum", "Cirsium arvense", "Juncus articulatus",
"Eleocharis palustris", "Calliergonella cuspidata", "Rumex acetosa",
"Trifolium pratense", "Anthoxanthum odoratum", "Plantago lanceolata",
"Aira praecox", "Hypochaeris radicata", "Potentilla palustris",
"Vicia latifolia", "Salix repens", "Empetrum nigrum")
# create a data.frame and promote to class 'Taxonomy'
t <- data.frame(abbr = unique(s$abbr), taxon)
( t <- taxonomy(t) )
# couple 'Species' and 'Taxonomy' objects
# we should not get any mismatches
st <- SpeciesTaxonomy(s, t, verbose = TRUE)
# sites data
data(dune.env)
x <- data.frame(plot = row.names(dune.env), dune.env)
# groom plot names
x$plot <- paste("dn", x$plot, sep = "")
( s <- stackSites(x, verbose = TRUE) )
( x <- Vegsoup(st, s, coverscale = "ordinal") )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.