Functions to obtain the subtaxonomy or the set of taxa included in a particular taxonomic group, according to the zoologTaxonomy by default.

Subtaxonomy(
  taxon,
  taxonomy = zoologTaxonomy,
  thesaurus = zoologThesaurus$taxon
)

SubtaxonomySet(
  taxon,
  taxonomy = zoologTaxonomy,
  thesaurus = zoologThesaurus$taxon
)

GetSpeciesIn(
  taxon,
  taxonomy = zoologTaxonomy,
  thesaurus = zoologThesaurus$taxon
)

Arguments

taxon

A name of any of the taxa, at any rank included in the taxonomy (from species to family in the zoolog taxonomy).

taxonomy

A taxonomy from which to extract the subtaxonomy. By default taxonomy = zoologTaxonomy.

thesaurus

A thesaurus allowing datasets with different nomenclatures to be merged. By default thesaurus = zoologThesaurus$taxon.

Value

Subtaxonomy returns a data.frame with the same structure of the input taxonomy but with only the species (rows) included in the queried taxon, and the taxonomic ranks (columns) up to its level.

SubtaxonomySet returns a character vector including a unique copy (set) of all the taxa, at any taxonomic rank, under the queried taxon. Equivalent to Subtaxonomy but as a set instead of a dataframe.

GetSpeciesIn returns a character vector including the species included in the queried taxon.

Examples

## Get species of genus Sus:
GetSpeciesIn("Sus")
#> [1] "Sus domesticus" "Sus scrofa"    

## Get species of family Bovidae:
GetSpeciesIn("Bovidae")
#> [1] "Bos taurus"      "Bos primigenius" "Ovis aries"      "Ovis orientalis"
#> [5] "Capra hircus"    "Capra aegagrus"  "Gazella gazella"

## Get the subtaxonomy of the Tribe Caprini:
Subtaxonomy("Caprini")
#>           Species Genus   Tribe
#> 3      Ovis aries  Ovis Caprini
#> 4 Ovis orientalis  Ovis Caprini
#> 5    Capra hircus Capra Caprini
#> 6  Capra aegagrus Capra Caprini

## Use SubtaxonomySet to join categories for computing log-ratios.
## For this, we read an example dataset:
dataFile <- system.file("extdata", "dataValenzuelaLamas2008.csv.gz",
                        package="zoolog")
dataExample <- utils::read.csv2(dataFile,
                                na.strings = "",
                                encoding = "UTF-8")
## We illustrate with a subset of cases to make the example run
## sufficiently fast:
dataExample <- dataExample[1:1000, ]
## Compute the log-ratios joining all taxa from tribe \emph{Caprini}
## to use the reference of \emph{Ovis aries}:
categoriesCaprini <- list('Ovis aries' = SubtaxonomySet("Caprini"))
dataExampleWithLogs <- LogRatios(dataExample,
                                 joinCategories = categoriesCaprini)
#> Warning: Reference for Sus scrofa used for cases of Sus domesticus.
#>    Reference for Sus scrofa used for cases of Sus.
#>    Set useGenusIfUnambiguous to FALSE if this behaviour is not desired.