Description Objects from the Class Slots Methods Author(s) See Also Examples
A super class containing classes Species
and Taxonomy
. The class
guarantees that both objects match by their primary key ('abbr'
).
Objects can be created by calls of the form
new("SpeciesTaxonomy", ...)
, where ...
expands to slots
'species' and 'taxonomy', each of which is a class as
indicated by the slot name. Note, class names in package vegsoup
always start with an uppercase letter. When using the new()
method
to initialize an object of class "SpeciesTaxonomy"
the corresponding
function SpeciesTaxonomy
is called internally in order to ensure data
integrity. In this way it might be more transparent for users to call
the constructor function SpeciesTaxonomy
directly, which will
return an object of class "SpeciesTaxonomy"
as well.
species
:Object of class Species
,
see class Species
for details.
taxonomy
:Object of class Taxonomy
,
see class Taxonomy
for details.
Unlike classes Species
and Taxonomy
there exists no
custom initialize method. Therefore, function SpeciesTaxonomy
should
be used in cases where the data integrity is unsure.
Sub-setting methods are provided for classes Species
,
and Taxonomy
, but not for this class. It is possible,
however, to replace one of the slots by the respective replacement method,
which will take care about sub-setting of the remaining slot
(see ‘Methods for "species<-"’ and ‘Methods for "taxonomy<-"’).
signature(obj = "SpeciesTaxonomy")
:
Accessor method for slot 'species'
returning a data.frame
signature(obj = "SpeciesTaxonomy")
:
Accessor method for slot 'taxonomy'
returning a data.frame
.
signature(x = "SpeciesTaxonomy")
:
bind
method to combine two or more objects.
signature(x = "SpeciesTaxonomy")
:
retrieve column name of slot 'species' (see Species
).
signature(x = "SpeciesTaxonomy")
:
subset parts of an object (see Species
).
subset slot 'species' as to contain only the taxa given by an
object of class Taxonomy
, which by itself will replace
slot 'taxonomy'.
subset slot 'species' as above, but by an object of class
"data.frame"
. The latter is coerced to class Taxonomy
.
subset slot 'taxonomy' as to contain only the taxa given by an
object of class Species
, which by itself will replace
slot 'species'.
experimental!
subset slot 'taxonomy' as above, but by an object of class
"data.frame"
. The latter is coerced to class Species
.
Roland Kaiser
SpeciesTaxonomy
,
Species
,
Sites
,
Taxonomy
,
taxval
inpackage vegdata.
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 53 54 55 56 57 | require(vegsoup)
showClass("SpeciesTaxonomy")
data(barmstein)
x <- barmstein
# extract from object for demonstration
s <- species(species(x)) # returns a data.frame
t <- taxonomy(taxonomy(x)) # returns a data.frame
# using the new() inititialization method
st0 <- new("SpeciesTaxonomy")
slotNames(st0) # see slots names
st0@species <- species(s) # species method for class data.frame, returns a 'Species' object
st0@taxonomy <- taxonomy(t) # taxonomy method for class data.frame, returns a 'Taxonomy' object
st0
# supply slot in call to new()
new("SpeciesTaxonomy", species = species(s), taxonomy = taxonomy(t))
# equivalent. preferred and significantly shorter and more transparent interface
st2 <- SpeciesTaxonomy(s, t, verbose = TRUE)
identical(st0, st2)
# modify and subset an object by replacing slots
# in this way we can take subset of species
obj <- st2
obj1 <- obj2 <- obj3 <- obj
# the first 10 species
( taxonomy(obj1) <- taxonomy(obj1)[1:10, ] )
# specific genus
( taxonomy(obj2) <- taxonomy(obj2)[grep("Carex", taxonomy(obj)$taxon), ] )
# get a subset of species, e.g. those occuring in the shrub layer 'sl'
i <- species(obj3)$layer == "sl"
( species(obj3) <- species(obj3)[i, ] )
# combine objects
obj1 <- SpeciesTaxonomy(s, t)
data(windsfeld)
x <- windsfeld
s2 <- species(x) # returns a class 'Species'
t2 <- taxonomy(x) # returns a class 'Taxonomy'
obj2 <- SpeciesTaxonomy(s2, t2)
( obj <- bind(obj1, obj2) )
# assign object of class SpeciesTaxonomy to an existing Vegsoup* object
## Not run:
# not implemented yet!
# Species(x) <- obj3
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.