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

Function to retrieve all species list #29

Closed
arw36 opened this issue Apr 21, 2018 · 8 comments
Closed

Function to retrieve all species list #29

arw36 opened this issue Apr 21, 2018 · 8 comments
Milestone

Comments

@arw36
Copy link

arw36 commented Apr 21, 2018

A major use for me is creating species lists by their upper taxonomy. To that end, I use this function frequently to retrieve a full species list with taxonomic information that I can then filter to a certain taxa group. Not sure if this is possible elsewhere in the package? I'm sure there is a way to clean or simplify this function to accommodate if the database changes-- current count is at 93,872.

rl_sp_all <- function(k){
    pg0 <- rl_sp(page=0, key = k)
    pg1 <-  rl_sp(page=1, key = k)
    pg2 <-  rl_sp(page=2, key = k)
    pg3 <-  rl_sp(page=3, key = k)
    pg4 <-  rl_sp(page=4, key = k)
    pg5 <-  rl_sp(page=5, key = k)
    pg6 <-  rl_sp(page=6, key = k)
    pg7 <-  rl_sp(page=7, key = k)
    pg8 <-  rl_sp(page=8, key = k)
    pg9 <-  rl_sp(page=9, key = k)
    all_pages <- rbind(pg0$result,pg1$result, pg2$result, pg3$result,pg4$result, pg5$result, pg6$result, pg7$result,  pg8$result,pg9$result)
}
@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

hi @arw36 sorry about the delay, was away.

Not clear exactly what your asking. Are you wondering if there's a function that already does this in the package?

Do you run the above function, and then filter to the taxa you want? And then get other IUCN data?

@arw36
Copy link
Author

arw36 commented Apr 25, 2018

Not really a question, more of a comment. Yes, I use this function and then filter to certain taxa groups and link to external datasets. I think this is more practical than selecting a certain page of taxonomy using rl_sp() or alternatively querying individual species through rl_search due to the issue of rate limiting.

@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

or alternatively querying individual species through rl_search

for some people that might be sufficient, e.g., if they only have a handful of species to get.

but yes, it seems like a good idea to be able to easily get all taxa.

@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

@arw36 reinstall and see ?rl_sp, try the example there for all results

@arw36
Copy link
Author

arw36 commented Apr 25, 2018

sweet! I think you are starting with page 1 rather than page 0? total count should be 93872 rather than 83872

@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

ah, ok

@sckott
Copy link
Contributor

sckott commented Apr 25, 2018

changed to 0

@arw36
Copy link
Author

arw36 commented Apr 25, 2018

Thanks!

@arw36 arw36 closed this as completed Apr 25, 2018
@sckott sckott added this to the v0.5 milestone Apr 25, 2018
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

2 participants