taxa (version 0.1.0)

taxonomy: Taxonomy class

Description

Stores a taxonomy composed of taxon() objects organized in a tree structure. This differs from the hierarchies() class in how the taxon() objects are stored. Unlike hierarchies(), each taxon is only stored once and the relationships between taxa are stored in an edgelist.

Usage

taxonomy(..., .list = NULL)

Arguments

...

Any number of object of class hierarchy() or character vectors.

.list

An alternate to the ... input. Any number of object of class hierarchy() or character vectors in a list. Cannot be used with ....

Value

An R6Class object of class Taxonomy

See Also

Other classes: hierarchies, hierarchy, taxa, taxmap, taxon_database, taxon_id, taxon_name, taxon_rank, taxon

Examples

Run this code
# NOT RUN {
# Making a taxonomy object with vectors
taxonomy(c("mammalia", "felidae", "panthera", "tigris"),
         c("mammalia", "felidae", "panthera", "leo"),
         c("mammalia", "felidae", "felis", "catus"))

# Making a taxonomy object from scratch
#   Note: This information would usually come from a parsing function.
#         This is just for demonstration.
x <- taxon(
  name = taxon_name("Notoryctidae"),
  rank = taxon_rank("family"),
  id = taxon_id(4479)
)
y <- taxon(
  name = taxon_name("Notoryctes"),
  rank = taxon_rank("genus"),
  id = taxon_id(4544)
)
z <- taxon(
  name = taxon_name("Notoryctes typhlops"),
  rank = taxon_rank("species"),
  id = taxon_id(93036)
)

a <- taxon(
  name = taxon_name("Mammalia"),
  rank = taxon_rank("class"),
  id = taxon_id(9681)
)
b <- taxon(
  name = taxon_name("Felidae"),
  rank = taxon_rank("family"),
  id = taxon_id(9681)
)

c <- taxon(
  name = taxon_name("Puma"),
  rank = taxon_rank("genus"),
  id = taxon_id(146712)
)
d <- taxon(
  name = taxon_name("Puma concolor"),
  rank = taxon_rank("species"),
  id = taxon_id(9696)
)

m <- taxon(
  name = taxon_name("Panthera"),
  rank = taxon_rank("genus"),
  id = taxon_id(146712)
)
n <- taxon(
  name = taxon_name("Panthera tigris"),
  rank = taxon_rank("species"),
  id = taxon_id(9696)
)

(hier1 <- hierarchy(z, y, x, a))
(hier2 <- hierarchy(c, b, a, d))
(hier3 <- hierarchy(n, m, b, a))

(hrs <- hierarchies(hier1, hier2, hier3))

taxonomy(hier1, hier2, hier3)
# }

Run the code above in your browser using DataCamp Workspace