ropensci / rfishbase

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

Command to access brain weight data from fishbase #140

Closed tjquimpo closed 6 years ago

tjquimpo commented 6 years ago

Dear administrators,

I wonder if there is a way to access the brain weight data in fishbase? Based on the reference by Boettiger and colleagues (2012, 2017), there is currently no means to do that.

Many thanks, Tim

sckott commented 6 years ago

can you show where you see it in the Fishbase website?

tjquimpo commented 6 years ago

On the species page (e.g. after searching for let's say the daisy parrotfish), it is located in the more information section as 'brains'.

cboettig commented 6 years ago

@tjquimpo I have an experimental version of this now on the 3.0 branch. Can you try:

devtools::install_github("ropensci/rfishbase@3.0")
library(rfishbase)

fish <- c("Oreochromis niloticus", "Salmo trutta")
brains(fish)
tjquimpo commented 6 years ago

@cboettig sorry for the late response.

I tried this out, and it looks good. It displays the brainweight, which is what we need. But I wonder why the other variables, e.g. SL and TL are not on display? Do I have to call a separate command to get them? Also, is there a way to access the brain data by calling the family (e.g. Labridae), instead of specifying the species?

cboettig commented 6 years ago

@tjquimpo Sorry for the slow reply here.

Note that SL and TL are already columns in the brains tables. If your screen isn't big enough, not all the columns (variables) will be listed. It might help to select just the columns you need, e.g.

library(rfishbase)
library(dplyr)

brains() %>% select(Species, BrainWeight, BodyWeight, SL, TL)

If you want all only the brains data of a family, say, simply use the species_list function to get a list of those species:

species_list(family = "Labridae") %>% 
  brains() %>% 
  select(Species, BrainWeight, BodyWeight, SL, TL)

I believe you will find this to be quite fast when using the 3.0 branch :)

cboettig commented 6 years ago

(Closing this for now, please re-open if you have any further issues with this. Also just a note, you can use the list_fields() function to help discover other tables that have the desired data. e.g. the morphometrics() table is a good go-to for length and related size information).