Skip to contents

Merge taxon concepts form a taxlist object into single ones.

Usage

merge_taxa(object, ...)

# S3 method for 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.

Value

An object of class taxlist.

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).

Author

Miguel Alvarez kamapu78@gmail.com

Examples

## Merge Cyperus papyrus and Cyperus dives
summary(Easplist, c(206, 197))
#> ------------------------------ 
#> concept ID: 206 
#> view ID: 1 
#> level: species 
#> parent: 54853 Cyperus L. 
#> 
#> # accepted name: 
#> 206 Cyperus papyrus L. 
#> 
#> # synonyms (2): 
#> 52612 Cyperus papyrus ssp. antiquorum (Willd.) Chiov. 
#> 52613 Cyperus papyrus ssp. nyassicus Chiov. 
#> ------------------------------ 
#> concept ID: 197 
#> view ID: 1 
#> level: species 
#> parent: 54853 Cyperus L. 
#> 
#> # accepted name: 
#> 197 Cyperus dives Delile 
#> 
#> # synonyms (5): 
#> 52000 Cyperus immensus C.B. Clarke 
#> 52600 Cyperus exaltatus var. dives (Delile) C.B. Clarke 
#> 52601 Cyperus alopecuroides var. dives Boeckeler 
#> 52602 Cyperus immensus var. petherickii (C.B. Clarke) Kük. 
#> 52603 Cyperus petherickii C.B. Clarke 
#> ------------------------------

merged_cyperus <- merge_taxa(object = Easplist, concepts = c(206, 197),
    print_output = TRUE)
#> ------------------------------ 
#> concept ID: 206 
#> view ID: 1 
#> level: species 
#> parent: 54853 Cyperus L. 
#> 
#> # accepted name: 
#> 206 Cyperus papyrus L. 
#> 
#> # synonyms (8): 
#> 197 Cyperus dives Delile 
#> 52000 Cyperus immensus C.B. Clarke 
#> 52600 Cyperus exaltatus var. dives (Delile) C.B. Clarke 
#> 52601 Cyperus alopecuroides var. dives Boeckeler 
#> 52602 Cyperus immensus var. petherickii (C.B. Clarke) Kük. 
#> 52603 Cyperus petherickii C.B. Clarke 
#> 52612 Cyperus papyrus ssp. antiquorum (Willd.) Chiov. 
#> 52613 Cyperus papyrus ssp. nyassicus Chiov. 
#> ------------------------------

## Subset with Kyllinga species
ky <- subset(Easplist, TaxonName == "Kyllinga", keep_children = TRUE,
    keep_parents = TRUE)
ky
#> object size: 14.3 Kb 
#> validation of 'taxlist' object: TRUE 
#> 
#> number of taxon usage names: 45 
#> number of taxon concepts: 14 
#> trait entries: 8 
#> number of trait variables: 1 
#> taxon views: 3 
#> 
#> concepts with parents: 13 
#> concepts with children: 3 
#> 
#> hierarchical levels: form < variety < subspecies < species < complex < genus < family 
#> number of concepts in level form: 0
#> number of concepts in level variety: 2
#> number of concepts in level subspecies: 0
#> number of concepts in level species: 10
#> number of concepts in level complex: 0
#> number of concepts in level genus: 1
#> number of concepts in level family: 1
#> 
indented_list(ky)
#> Cyperaceae Juss.
#>  Kyllinga Rottb.
#>    Kyllinga alata Nees
#>    Kyllinga brevifolia Rottb.
#>    Kyllinga nemoralis (J.R. Forst. & G. Forst.) Dandy ex Hutch. & Dalziel
#>    Kyllinga pumila Michx.
#>    Kyllinga erecta Schumach.
#>      Kyllinga erecta var. erecta Schumach.
#>      Kyllinga erecta var. africana (Kük.) S.S. Hooper
#>    Kyllinga crassipes Boeckeler
#>    Kyllinga elatior Kunth
#>    Kyllinga odorata Vahl
#>    Kyllinga species 
#>    Kyllinga bulbosa P. Beauv. 

## Merge to species and family
merge_taxa(ky, level = c("species", "family"))
#> object size: 14.2 Kb 
#> validation of 'taxlist' object: TRUE 
#> 
#> number of taxon usage names: 45 
#> number of taxon concepts: 11 
#> trait entries: 8 
#> number of trait variables: 1 
#> taxon views: 3 
#> 
#> concepts with parents: 10 
#> concepts with children: 1 
#> 
#> hierarchical levels: form < variety < subspecies < species < complex < genus < family 
#> number of concepts in level form: 0
#> number of concepts in level variety: 0
#> number of concepts in level subspecies: 0
#> number of concepts in level species: 10
#> number of concepts in level complex: 0
#> number of concepts in level genus: 0
#> number of concepts in level family: 1
#> 

## Merge to variety and genus
merge_taxa(ky, level = c("variety", "genus"))
#> object size: 13.7 Kb 
#> validation of 'taxlist' object: TRUE 
#> 
#> number of taxon usage names: 45 
#> number of taxon concepts: 4 
#> trait entries: 0 
#> number of trait variables: 1 
#> taxon views: 3 
#> 
#> concepts with parents: 3 
#> concepts with children: 2 
#> 
#> hierarchical levels: form < variety < subspecies < species < complex < genus < family 
#> number of concepts in level form: 0
#> number of concepts in level variety: 2
#> number of concepts in level subspecies: 0
#> number of concepts in level species: 0
#> number of concepts in level complex: 0
#> number of concepts in level genus: 1
#> number of concepts in level family: 1
#>