ropensci / rfishbase

R interface to the fishbase.org database
https://docs.ropensci.org/rfishbase
111 stars 40 forks source link

How do I get the taxonomic classification of the fish species? #126

Closed tjquimpo closed 5 years ago

tjquimpo commented 7 years ago

Hello,

I loaded my targeted species using the species_list and species functions. However, I could not find a function that extracted the higher taxonomic classifications (e.g. orders, class, etc.). I read in Boettiger et al. (2012) that you can use the fish_names function; but, in the current version of rfishbase, this function is no longer available. Are there any similar function(s) wherein I can load the other taxonomic units? Many thanks.

Respectfully, Tim

cboettig commented 7 years ago

Check out all the columns of the data frame returned rfishbase::load_taxa(), that should have all the taxonomic ranks (according to FishBase taxonomy, which may differ from other authorities), for all species in FishBase.

Apologies, the 2012 publication is now quite out of date relative to the current version of the package.

HTH,

Carl

sckott commented 7 years ago

also added a taxonomy() fxn - reinstall to get it - thoughts on it @cboettig ? keep or get rid of? changes?

sckott commented 7 years ago

see also #92

cboettig commented 7 years ago

Nice, thanks @sckott. Can you add an example of this in the readme.rmd too?

sckott commented 7 years ago

sure thing

sckott commented 7 years ago

One thing about the /taxonomy route is that we set it up so that it only accepts the query parameters genus and species - so we can't do the thing of passing in a species list like in other fxns

so users have to do lapply or so, like

spp <- list(c("Oreochromis", "amphimelas"), c("Oreochromis", "mweruensis"))
Map(function(x) taxonomy(x[1], x[2]), spp)

is that acceptable? or too cumbersome?

sckott commented 7 years ago

i guess one option is to do allow passing in a list of genus+epithet names, and internally break names into genus, species, and map over each name

cboettig commented 7 years ago

Good questions. Yeah, obviously a consistent query interface would be nice, though I suppose if necessary that could be done merely on the R level, so the R user could pass the same species_list.

Having a way to return the full taxonomy table, a la load_taxa() is probably helpful though, since I think a common use case for the taxonomy table is actually to start with a larger group, e.g. Family, and get a list of all species in that family for later use in the other functions.

nbfernan commented 3 years ago

Hi @cboettig , I am coming across this issue and had a similar question myself to the original post/question. Has this been solved in the later versions of rfishbase (3.0)? I can pull the whole data.frame of taxonomic descriptions through load_taxa(), but it would be helpful if there was an option to pass the species_list through and only obtain what is needed in terms of higher level taxonomic descriptions. Any insight would be appreciated!

cboettig commented 3 years ago
library(rfishbase)
library(dplyr)
rfishbase::load_taxa() %>% 
  filter(Species %in% c(Oreochromis mweruensis",  "Oreochromis amphimelas")) %>%
 collect()