Learn R Programming

taxlist (version 0.2.3)

taxon_relations: Retrieve or replace slot taxonRelations in taxlist objects

Description

Retrieve the content of slot taxonRelations from a taxlist object or replace it by a new data frame.

Usage

taxon_relations(taxlist, ...)

# S4 method for taxlist taxon_relations(taxlist, ...)

taxon_relations(taxlist) <- value

# S4 method for taxlist,data.frame taxon_relations(taxlist) <- value

add_concept(taxlist, TaxonName, ...)

# S4 method for taxlist,character add_concept(taxlist, TaxonName, Level, ...)

# S4 method for taxlist,taxlist add_concept(taxlist, TaxonName, insert_view, ...)

update_concept(taxlist, ConceptID, ...)

# S4 method for taxlist,numeric update_concept(taxlist, ConceptID, ...)

Value

An object of class taxlist with added names and concepts.

Arguments

taxlist

A taxlist object.

...

Further arguments passed among methods.

value

A data.frame object to be set as slot taxonRelations.

TaxonName

Character vector with the accepted name for the new taxon concepts.

Level

Character vector indicating the level of the concept in the list.

insert_view

A numeric (integer) vector, indicating the views to be inserted in taxlist or the value TRUE (see details).

ConceptID

Concept IDs to be updated.

Author

Miguel Alvarez kamapu78@gmail.com

Details

The replacement method taxon_relations<- should be only used when constructing taxlist objects from an empty one (prototype).

New concepts should be first added to a taxlist object using their respective accepted names. Synonyms can be further provided using the function add_synonym().

Additional named vectors can be provided to be included in slot taxonNames, in the cases where those variables already exist, otherwise they will be ignored.

It is recommended also to provide a concept view as ViewID (see taxon_views()). For adding a new view, use add_view().

See Also

taxlist

Examples

Run this code
## Subset for the genus Euclea and display of slot 'taxonNames'
Euclea <- subset(
  x = Easplist, subset = charmatch("Euclea", TaxonName),
  slot = "names"
)
Euclea <- get_children(Easplist, Euclea)

Euclea
taxon_relations(Euclea)

## Subset with family Ebenaceae and children
Ebenaceae <- subset(Easplist, charmatch("Ebenaceae", TaxonName))
Ebenaceae <- get_children(Easplist, Ebenaceae)

Ebenaceae
summary(object = Ebenaceae, ConceptID = "all", maxsum = 100)

## Adding a new concept
Ebenaceae <- add_concept(
  taxlist = Ebenaceae, TaxonName = "Euclea acutifolia",
  AuthorName = "E. Mey. ex A. DC.", Level = "species", Parent = 55707, ViewID = 1
)

## A summary again
Ebenaceae
summary(Ebenaceae, "all", maxsum = 100)

## Display two Typha species
summary(Easplist, c("Typha domingensis", "Typha latifolia"))

## Update a concept
summary(Easplist, "Corchorus olitorius")
Easplist <- update_concept(
  taxlist = Easplist, ConceptID = 155,
  Level = "subspecies"
)
summary(Easplist, "Corchorus olitorius")

Run the code above in your browser using DataLab