subset {vegtable} | R Documentation |
Subset functions for vegtable objects
Description
Produce subsets of vegtable objects.
Logical operations can be applied either to the plots, or the relations, which are the main slots in that class.
This method can be referred to the slot species
the same way as
taxlist::subset()
, then the rest of the data will include only
references to the subset of species list.
Usage
## S4 method for signature 'vegtable'
subset(
x,
subset,
slot = "header",
keep_children = FALSE,
keep_parents = FALSE,
relation,
...
)
Arguments
x |
A vegtable object for subset. |
subset |
Logical expression for the subset. |
slot |
Character value indicating the slot used as reference for subset. At the moment only the values "taxonNames", "taxonRelations", "taxonTraits", "header", "samples", and "relations" are accepted. The three first values will be applied to the respective slots in the contained taxlist object (slot species). |
keep_children |
Argument passed to |
keep_parents |
Argument passed to |
relation |
Character value indicating the relation (slot relations) to be used as reference for subset. |
... |
Further arguments passed from or to other methods. |
Value
A S4 object of class vegtable.
Author(s)
Miguel Alvarez kamapu78@gmail.com
Examples
## Subset by taxon name
Kenya_sub <- subset(
x = Kenya_veg, subset = TaxonName == "Tagetes",
slot = "taxonNames", keep_children = TRUE, keep_parents = TRUE
)
summary(Kenya_sub)
summary(Kenya_sub@species)
## Subset by taxon relations
Kenya_sub <- subset(
x = Kenya_veg, subset = Level == "species",
slot = "taxonRelations"
)
summary(Kenya_sub)
summary(Kenya_sub@species)
## Subset by taxon traits
Kenya_sub <- subset(
x = Kenya_veg, subset = lf_behn_2018 == "obligate_annual",
slot = "taxonTraits"
)
summary(Kenya_sub)
summary(Kenya_sub@species)
## Subset by header
Kenya_sub <- subset(x = Kenya_veg, subset = ALTITUDE <= 1000, slot = "header")
summary(Kenya_sub)
## Subset by samples (after converting coverage)
Kenya_veg <- cover_trans(x = Kenya_veg, to = "cover_percentage", rule = "middle")
Kenya_sub <- subset(x = Kenya_veg, subset = cover_percentage >= 50, slot = "samples")
summary(Kenya_sub)
## Subset by relations
Kenya_sub <- subset(
x = Kenya_veg, subset = as.integer(YEAR) >= 2000,
slot = "relations", relation = "REFERENCE"
)
summary(Kenya_sub)