Closed amroco closed 8 years ago
Thanks for the report @amroco will have a look
@amroco Please do share what your query was
and what version of rfishbase
/R/operating system are you using
Sweet, thanks bud,
New_Taxon_invert_spp_val=validate_names(New_Taxon_invert_spp) str(New_Taxon_invert_spp_val) New_Taxon_invert_spp_val=as.character(New_Taxon_invert_spp_val)
Difference=New_Taxon_invert_spp[!(New_Taxon_invert_spp %in% New_Taxon_invert_spp_val)] str(Difference) Difference
New_Taxon_for_upload_just_inverts_addinfo <- species(New_Taxon_invert_spp_val, fields=c("SpecCode"))
head(New_Taxon_for_upload_just_inverts_addinfo) Thanks so much, Amy
can you paste in the contents of New_Taxon_invert_spp
or email it to me (scott@ropensci.org)
or at least part of its contents, including some causing a problem
@cboettig hmm, looking into this and getting the same error as above, looks like may come down to the internal taxa()
function that is matching names against a cached version of a species table. Is this species table only for fishbase, or for both fishbase and sealifebase?
Will email it :) I had a similar problem with GenCodes for FB, but worked that out- however my solution isn't fixing this issue (partially because I don't know what I did to fix that problem in the first place). Cheers, A
thanks
been making some small changes to the API, so maybe something broken on that end
@amroco try it again after re-installing from a different branch: devtools::install_github("ropensci/rfishbase@sckott-endpoint-fix")
@cboettig I made a change on branch sckott-endpoint-fix
- the changes I made https://github.com/ropensci/rfishbase/compare/master...sckott-endpoint-fix were just to get a unique set of results when calling speccodes()
and when calling species_names()
as in some cases those were resulting in more than one result, some of which were the same names - Anything seem off about that. All tests and checks are fine
good catch, thanks. PR?
yeah
@amroco
Reinstall from master just so that we're o the same page devtools::install_github("ropensci/rfishbase")
Then here's the code I have, some var names changed to be a bit shorter
library(rfishbase)
options(FISHBASE_API = "http://fishbase.ropensci.org/sealifebase")
xx <- read.csv("~/Downloads/New_Taxon_invert_spp.csv", stringsAsFactors = FALSE)[,2]
length(xx)
xx_val <- validate_names(xx)
length(xx_val)
xx_val <- as.character(xx_val)
# however, on this next line I get that error you get
# which looks like it drills down to be a http request error, but i haven't been
# able to track it down yet
(x_addinfo <- species(xx_val, fields="SpecCode"))
although, when I do
res <- list()
for (i in seq_along(xx_val)) {
cat(i, sep = "\n")
res[[i]] <- species(xx_val[i], fields="SpecCode")
}
it works fine, so seems maybe there's something going on with the http requests, maybe too many requests back to back - Still trying to track this down...
Thanks Scott, Currently:
res <- list() for (i in seq_along(New_Taxon_inverts_val)) { cat(i, sep = "\n") res[[i]] <- species(New_Taxon_inverts_val[i], fields="SpecCode") }
just produces a list of sequential numbers from 1 to 304 for me, so no luck there at the moment.
The output is in the res
object :)
you can combine like dplyr::bind_rows(res)
yikes! that;s a glaring rookie mistake, thanks for your help :)
i think i figured out the problem, fix coming
@amroco try reinstalling like devtools::install_github("ropensci/rfishbase@sckott-make-unique")
that should work now, there were some names giving back duplicate codes for some reason, and then the internal parsing borked on that.
did that work for you @amroco
@amroco merged those changes into master, now just do devtools::install_github("ropensci/rfishbase")
the other branch is now deleted
Hi,
Getting the following error when querying SLB for SpecCodes for a list of species, (but no dramas when using the same list of species in the validate_names function).
Error in vapply(elements, encode, character(1)) : values must be length 1, but FUN(X[[1]]) result is length 2
Thanks