Reclassify ITIS species based off a list of higher taxonomic groupings

itis_reclassify(tsn, categories, uncategorized_name = "Uncategorized")

Arguments

tsn

A vector of Taxonomic Serial Numbers to be evaluated.

categories

A list of the categories and associated TSN values. within a list of a category, a minus (-) in front of a number is short hand to remove organisms within that tsn's taxonomy from being listed in a category. See the example for an instance where that makes sense.

uncategorized_name

A string of what to call the missing value.

Value

df_out, tsn_indata

Examples

itis_reclassify(tsn = c(83677, # subphylum Crustacea; shellfish
                        172746, # Scophthalmus aquosus; finfish
                        173747, # class Reptilia; uncategorized as part of tetrapoda
                        98678), # Cancer borealis; shellfish
                categories = list('Finfish' = c(914179, #  Infraphylum  Gnathostomata
                                               -914181), # Tetrapoda; - = do NOT include
                                  "Shellfish" = c(82696, # Phylum  Arthropoda
                                                  69458)), # Phylum  Mollusca
                uncategorized_name = "uncategorized")
#> $df_out
#>      TSN      category valid      rank              sciname
#> 1 172746       Finfish valid   species Scophthalmus aquosus
#> 2  83677     Shellfish valid subphylum            Crustacea
#> 3  98678     Shellfish valid   species      Cancer borealis
#> 4 173747 uncategorized valid     class             Reptilia
#> 
#> $tsn_indata
#> $`173747`
#>            name         rank     id
#> 1      Animalia      kingdom 202423
#> 2     Bilateria   subkingdom 914154
#> 3 Deuterostomia infrakingdom 914156
#> 4      Chordata       phylum 158852
#> 5    Vertebrata    subphylum 331030
#> 6 Gnathostomata  infraphylum 914179
#> 7     Tetrapoda   superclass 914181
#> 8      Reptilia        class 173747
#> 
#> attr(,"class")
#> [1] "classification"
#> attr(,"db")
#> [1] "itis"
#>