verify_synonyms <- function(
taxa = NULL # Dataframe with taxa to verify
verified_synonyms = NULL # Dataframe with verified synonym info
)
Parameters
taxa: a dataframe with at least the following columns
[ ] backbone_taxonKey
[ ] backbone_scientificName
[ ] backbone_acceptedKey
[ ] backbone_accepted
verified_synonyms: a dataframe with at least the following columns
[ ] backbone_taxonKey
[ ] backbone_scientificName
[ ] backbone_acceptedKey
[ ] backbone_accepted
[ ] backbone_kingdom: to be populated from GBIF (is not in taxa)
[ ] date_added: to be populated by function
[ ] verified_key: to be populated manually by expert. Not required by this function, but any other functionality will use this key so it is good to check its existence.
[ ] remarks: NO CHECK, IS NOT REQUIRED
Functionality (pseudo code):
if in verified_synonyms:
if taxa.backbone_scientificName != verified_synonyms.backbone_scientificName:
update in verified_synonyms
add to updated_scientificName
if taxa.backbone_accepted != verified_synonyms.backbone_accepted:
update in verified_synonyms
add to updated_accepted
else
do nothing
else (not in verified_synonyms):
add to verified_synonyms
add to new_synonyms
if in verified_synonyms, but not in taxa:
add to unused_synonyms
Return
[ ] verified_synonyms: same as input df, but now with updated info. Could be written to file outside the function.
[ ] new_synonyms: a subset of verified_synonyms (same columns) with synonyms relations that were added (found in taxa, but not in verified_synonyms)
[ ] unused_synonyms: a subset of verified_synonyms (same columns) with unused synonym relations (found in verified_synonyms, but not in taxa)
[ ] updated_scientificName: a df with backbone_scientificName + updated_backbone_scientificName
[ ] updated_accepted: a df with backbone_accepted + updated_backbone_accepted
Documentation
[ ] Document all above as succinct as possible with roxygen
Parameters
taxa
: a dataframe with at least the following columnsverified_synonyms
: a dataframe with at least the following columnstaxa
)Functionality (pseudo code):
Return
verified_synonyms
: same as input df, but now with updated info. Could be written to file outside the function.new_synonyms
: a subset ofverified_synonyms
(same columns) with synonyms relations that were added (found in taxa, but not in verified_synonyms)unused_synonyms
: a subset ofverified_synonyms
(same columns) with unused synonym relations (found in verified_synonyms, but not in taxa)updated_scientificName
: a df withbackbone_scientificName
+updated_backbone_scientificName
updated_accepted
: a df withbackbone_accepted
+updated_backbone_accepted
Documentation