merge_taxa: Merge concepts or move names

View source: R/merge_taxa.R

merge_taxaR Documentation

Merge concepts or move names

Description

Merge taxon concepts form a taxlist object into single ones.

Usage

merge_taxa(object, ...)

## S3 method for class 'taxlist'
merge_taxa(
  object,
  concepts,
  level = NULL,
  delete_nomatch = FALSE,
  print_output = FALSE,
  ...
)

Arguments

object, taxlist

Object of class taxlist.

...

Further arguments to be passed to or from other methods.

concepts

Numeric (integer) vector including taxon concepts to be merged.

level

Character vector with queried taxonomic ranks. This setting works only if concepts are missing. ranks in between will be merged to their respective parents by merge_to_parent(). Non queried ranks as well as rankless concepts will be deleted from the output.

delete_nomatch

A logical value indicating whether no matched ranks (i.e. top rank and rankless concepts) should be deleted from the output or not.

print_output

Logical value indicating whether the merged concept should be displayed in the console. Thi works only if a vector is provided at concepts.

Details

Taxon concepts indicated in argument concepts will be merged into a single concept. The new concept inherits the ID and respective attributes from slots taxonRelations and taxonTraits from the first taxon concept indicated in argument concepts.

For convenience the resulting concept can be displayed by setting print_output=TRUE but only when using argument concepts.

An alternative application of this function is implemented through the argument level, where all lower rank taxa will be merged to the indicated level or higher (if parent of merged taxa are at a higher rank).

Value

An object of class taxlist.

Author(s)

Miguel Alvarez kamapu78@gmail.com

Examples

## Merge Cyperus papyrus and Cyperus dives
summary(Easplist, c(206, 197))

merged_cyperus <- merge_taxa(object = Easplist, concepts = c(206, 197),
    print_output = TRUE)

## Subset with Kyllinga species
ky <- subset(Easplist, TaxonName == "Kyllinga", keep_children = TRUE,
    keep_parents = TRUE)
ky
indented_list(ky)

## Merge to species and family
merge_taxa(ky, level = c("species", "family"))

## Merge to variety and genus
merge_taxa(ky, level = c("variety", "genus"))

kamapu/taxlist documentation built on Feb. 17, 2024, 8:27 a.m.