taxize: new function id2name() and WORMS in downstream()

Curious to get any feedback on some new things in the development version of taxize


Via a conversation with a taxize user recently, I realized that taxize has no easy way of getting a taxonomic name for a taxonomic identifier. So I thought we should have it. Enter the id2name() function. it’s setup similar to many functions in taxize, with a single function, and then S3 methods for each data source. You can select the data source with the db parameter or pass the output of a get_*() call to id2name for supported data sources.

Right now the data sources supported are: tol, itis, ncbi, worms, gbif, col, bold

Install from the id2name branch (related issue #712):

# restart your R session
?id2name # get help

Here’s an example:

id2name(19322, db = "itis")
#> $`19322`
#>      id              name    rank   status parent_tsn
#> 1 19322 Quercus douglasii Species accepted      19276
#> attr(,"class")
#> [1] "id2name"
#> attr(,"db")
#> [1] "tsn"

downstream: worms

Via a tweet it seems that there’s a desire to have WORMS as a data source in the downstream() function, where you can get taxonomic names for ranks lower than direct children of a target rank. E.g., get all species in a family.

Install from the id2name branch (related issue #713):

# restart R
?downstream # get help


# by worms AphiaID
x <- downstream(125732, db = 'worms', downto = 'species')
#>       id             name    rank
#> 1 300720  Gadus abyssorum species
#> 2 154763 Gadus aeglefinus species
#> 3 300721     Gadus agilis species
#> 4 300723    Gadus albidus species
#> 5 300722    Gadus albidus species
#> 6 300724   Gadus arenosus species

# or by name, passes through `get_wormsid()` (not run)
downstream("Gadus", db = 'worms', downto = 'species')