Function to retrieve all species list
arw36 opened this issue · comments
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)
}
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?
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.
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.
@arw36 reinstall and see ?rl_sp
, try the example there for all results
sweet! I think you are starting with page 1 rather than page 0? total count should be 93872 rather than 83872
ah, ok
changed to 0
Thanks!