Learn R Programming

taxotools (version 0.0.139)

merge_lists: merge two lists of names

Description

Useful in generating a master list of names from multiple sources

Usage

merge_lists(master = NULL, checklist = NULL, output = "all", verbose = TRUE)

Value

Data frame with addition column merge_tag. The merge_tag contains four possible values.

add -

checklist names that matched using synonym linkages including direct matches

new -

checklist names that did NOT match with master. Potentially new taxa

multi -

taxon from checklist for which two synonyms matched with two different accepted names in master

Arguments

master

master list of names

checklist

list to be merged

output

data returned by the function, one of the five options all, onlyadd, add, merged, new or multi. Default all

verbose

verbose output on the console

Details

Matches names is checklist with names on master and returns following data:

onlyadd

= add : returns records from checklist that match with master

add

= orig + add : returns all records from master + matched records from checklist

merged

= orig + add + new : returns all records from master + matched records from checklist + new taxon from checklist

new

= returns only new taxon entities that did not match with master

multi

= taxon from checklist for which two synonyms matched with two different accepted names in master

See Also

Other List functions: DwC2taxo(), cast_cs_field(), compact_ids(), get_synonyms(), match_lists(), melt_cs_field(), syn2taxo(), synonymize_subspecies(), taxo2DwC(), taxo2doc(), taxo2syn(), wiki2taxo()

Examples

Run this code
# \donttest{
master <- data.frame("id" = c(1,2,3),
                     "canonical" = c("Hypochlorosis ancharia",
                                     "Hypochlorosis tenebrosa",
                                     "Hypochlorosis ancharia tenebrosa"),
                     "family" = c("Lycaenidae", "Lycaenidae", "Lycaenidae"),
                     "accid" = c(0,1,0),
                     "source" = c("itis","itis","itis"),
                     stringsAsFactors = FALSE)

checklist <- data.frame("id" = c(1,2,3,4,5),
                        "canonical" = c("Hypochlorosis ancharia",
                                        "Pseudonotis humboldti",
                                        "Myrina ancharia",
                                        "Hypochlorosis ancharia obiana",
                                        "Hypochlorosis lorquinii"),
                        "family" = c("Lycaenidae", "Lycaenidae", 
                                     "Lycaenidae", "Lycaenidae",
                                      "Lycaenidae"),
                        "accid" = c(0,1,1,0,0),
                        "source" = c("itis","wiki","wiki","itis",
                                     "itis"),
                        stringsAsFactors = FALSE)
merged_all <- merge_lists(master,checklist,output="all")
new_taxa <- merge_lists(master,checklist,output="new")
merged_with_new <- merge_lists(master,checklist,output="merged")
merged_add <- merge_lists(master,checklist,output="add")
multi_linked <- merge_lists(master,checklist,output="multi")
# }

Run the code above in your browser using DataLab