Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using species_list to generate a list of species from multiple families #136

Closed
Matt-Siskey opened this issue Apr 10, 2018 · 16 comments
Closed

Comments

@Matt-Siskey
Copy link

I have a list of 290 families that I am trying to use to generate a list of the respective species within them. I have been using species_list(Family = c('Family1','Family2','Family3')) to attempt this, but I get the following error. Why isn't this working? It seems straight forward enough.

Warning message:
In Family == c("Chlamydoselachidae", "Hexanchidae", "Heptranchidae", :
longer object length is not a multiple of shorter object length

@sckott
Copy link
Contributor

sckott commented Apr 10, 2018

please include your R session info, thanks

@Matt-Siskey
Copy link
Author

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

@Matt-Siskey
Copy link
Author

It seems to work when I include 2 families, but anything more than 3 and it blows up.

@sckott
Copy link
Contributor

sckott commented Apr 10, 2018

@cboettig it's not clear to me if this https://github.com/ropensci/rfishbase/blob/master/R/species_list.R#L69-L82 is supposed to handle more than 1 name as input, or only 1 at a time? It's looking to me like it is supposed to only handle 1 at a time. if so should we document and stop on names > length == 1 ?

@Matt-Siskey
Copy link
Author

Okay, so essentially I will need to do a separate species_list for each of the 290 families I need species lists from?

@sckott
Copy link
Contributor

sckott commented Apr 11, 2018

you might have to, but i'm trying to figure out from my colleague (@cboettig ) what a function does that he wrote

@cboettig
Copy link
Member

@fishkey yeah, looks like that function isn't gracefully handling the fact that it's not finding any species in your third family.

You can see this by doing the vectorization 'manually', i.e.

out <- sapply(c("Chlamydoselachidae", "Hexanchidae", "Heptranchidae"), function(x) species_list(Family=x))
out
$Chlamydoselachidae
[1] "Chlamydoselachus africana"  "Chlamydoselachus anguineus"

$Hexanchidae
[1] "Heptranchias perlo"     "Hexanchus griseus"      "Hexanchus nakamurai"    "Notorynchus cepedianus"

$Heptranchidae
character(0)

Meanwhile, it's easy enough to work around using the fill taxa table and a bit of standard dplyr:

library(dplyr)
library(rfishbase)
fish <- rfishbase::load_taxa()
myfish <- fish %>%
   filter(Family %in%  c("Chlamydoselachidae", "Hexanchidae", "Heptranchidae"))

@Matt-Siskey
Copy link
Author

@sckott @cboettig thanks very much for your help!! the dplyr, etc. method worked very well. i dug more into why fishbase wasn't returning species for some families and there seem to be four things going on here, one of which you might want to hear about.

(1) spelling changes between fossil record entries and fishbase (generally, changing from 'didae' to 'dae')
(2) species from family from fossil record now included in a different family
(3) a page for that family exists on fishbase, but is empty (no genus, no species; e.g., https://goo.gl/nNRsti & https://goo.gl/TLVaj5)
(4) complete page exits on fishbase w/ genus and species, but returned character(0) (e.g., https://goo.gl/vn8yqi)

The 4th issue is the only one that puzzles me, and its not a big deal because it only occurred for ~1% of the families in my list. Anyway, thanks again for your help on this!

@cboettig
Copy link
Member

@fishkey thanks for the feedback! Re (4), it's possible that's a recent update to FishBase.org that we don't yet have in our database. @sckott thoughts?

@sckott sckott reopened this Apr 12, 2018
@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

(i assume you didn't mean to close @cboettig )

@cboettig
Copy link
Member

well, I think we've resolved the title issue(?) but we should let Matt close it out to confirm.

database syncing is probably a separate issue, yes?

@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

RE 4: our last Fishbase database update is from December 2017 https://fishbase.ropensci.org/versions/ - so entirely possible that it's a problem of newer data that we don't have yet.

we've done 1 year apart between most updates. although in an ideal world, we'd have updates much more often 😏

@Dengaloo
Copy link

Dengaloo commented Apr 12, 2018 via email

@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

thanks for the update @Dengaloo - Is it possible to get the March 2018 update? Or wait until June?

@Dengaloo
Copy link

Dengaloo commented Apr 12, 2018 via email

@sckott
Copy link
Contributor

sckott commented Apr 12, 2018

Okay, sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants