brunobrr / bdc

Check out the vignettes with detailed documentation on each module of the bdc package
https://brunobrr.github.io/bdc
GNU General Public License v3.0
23 stars 7 forks source link

bdc_query_names_taxadb() Error in object[[name, exact = TRUE]] : subscript out of bounds #245

Closed jt-tbc closed 1 year ago

jt-tbc commented 1 year ago

Hello,

I am experiencing issues when applying the bdc_query_names_taxadb() to a standard list of species names (keeping all other aguments as default, e.g.:

names_harmonization <- bdc_query_names_taxadb( species_NA$scientific_name )

I get the same error when running the standard example too. I have installed the latest version of bdc from github.

The full error I am getting is below:

Error in object[[name, exact = TRUE]] : subscript out of bounds In addition: Warning messages: 1: In assert_deprecated(dbdir, driver, read_only) : deprecated arguments will be removed from future releases, see function docs 2: In assert_deprecated(overwrite, lines) : deprecated arguments will be removed from future releases, see function docs

kguidonimartins commented 1 year ago

Thanks for reporting!

Warning messages seem to come from recent updates on the taxadb side (see here). Maybe keeping the previous version of the taxadb could remediate this problem for now.

Please, check your current taxadb version (mine is 0.1.5 yet).

packageVersion("taxadb")

If your version is 0.2.0, please reinstall the 0.1.5 with:

if (!require("remotes")) install.packages("remotes")
remotes::install_github("ropensci/taxadb@be2369e8229144847d8f16c71dd1f2de289e811d", force = TRUE)

Then, refresh your session and try the query again:

names_harmonization <- bdc_query_names_taxadb( species_NA$scientific_name )

We will work on these updates in the next days.

jt-tbc commented 1 year ago

Thanks for the response, I have run the above and now get the following error:

Native bulk importer found, attempting fast import of e91399e82bcb21e35289be93ef614b15327d5c813cc4b8619b43c0044eba8ad8 Native import failed, falling back on R-based parser Importing C:/Users/JoeTurner/AppData/Roaming/R/data/R/contentid/sha256/e9/13/e91399e82bcb21e35289be93ef614b15327d5c813cc4b8619b43c0044eba8ad8 in 100000 line chunks: Error: Parser Error: syntax error at or near "2022" LINE 1: CREATE TABLE 2022_dwc_gbif AS SELECT #1,#2,#3,#4,#5,...

black-snow commented 1 year ago

@kguidonimartins did you spot the cause already?

Also, is Error in object[[name, exact = TRUE]] : subscript out of bounds just a useless error message (no trace) generated by R or does it stem from this lib? I can't get a trace for it ...

P. S.: There's also a 0.1.6 of taxadb: https://cran.r-project.org/src/contrib/Archive/taxadb/

Error: Can't show last error because no error was recorded yet

kguidonimartins commented 1 year ago

@kguidonimartins did you spot the cause already?

Not yet! Maybe in the next few days.

Also, is Error in object[[name, exact = TRUE]] : subscript out of bounds just a useless error message (no trace) generated by R or does it stem from this lib? I can't get a trace for it ...

I still can't inform you about the error message. I have only identified the source of the warning message.

kguidonimartins commented 1 year ago

The latest version of bdc is on the go. We'll be back soon with more instructions. Thanks for your patience.

kguidonimartins commented 1 year ago

Folks, I think bdc_query_names_taxadb should work now. Please keep in mind that taxadb has disabled the following databases for a while: "tpl", "fb", "slb", "wd", "iucn".

The following code should work with no errors (but warnings messages are expected):

install.packages("taxadb")
if (!require("remotes")) install.packages("remotes")
remotes::install_github("brunobrr/bdc", force = TRUE)

## Make sure these package versions:
stopifnot(packageVersion("taxadb") == "0.2.0")
stopifnot(packageVersion("bdc") == "1.1.4")

bdc::bdc_query_names_taxadb(sci_name = "Myrsine coriacea", db = "gbif")
jt-tbc commented 1 year ago

Excellent, seems to work for me, I get the following warnings with the code you provided:

Querying using gbif database version 22.12

A total of 0 NA was/were found in sci_name.

1 names queried in 0 minutes

Warning messages: 1: In assert_deprecated(dbdir, driver, read_only) : deprecated arguments will be removed from future releases, see function docs 2: In assert_deprecated(overwrite, lines) : deprecated arguments will be removed from future releases, see function docs

kguidonimartins commented 1 year ago

Great. These warnings were expected, and they come from the taxadb update. Soon we will remove them. I'm closing this issue. Please feel free to reopen it whenever you need to.

black-snow commented 1 year ago

@kguidonimartins when can we expect the new version to hit CRAN? :)

kguidonimartins commented 1 year ago

We want to remove the warning messages from bdc_query_names_taxadb before submitting a new version to CRAN. Perhaps this will be done next weekend.