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

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

Closed
jt-tbc opened this issue Feb 17, 2023 · 10 comments

Comments

@jt-tbc
Copy link

jt-tbc commented Feb 17, 2023

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
Copy link
Collaborator

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
Copy link
Author

jt-tbc commented Feb 20, 2023

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
Copy link
Contributor

black-snow commented Feb 23, 2023

@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
Copy link
Collaborator

@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 added a commit that referenced this issue Feb 25, 2023
New momentarily deprecated dbs: tpl, fb, iucn.

Unfortunately, db version is hardcoded for now.

Related to #245
@kguidonimartins
Copy link
Collaborator

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

@kguidonimartins
Copy link
Collaborator

kguidonimartins commented Feb 27, 2023

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
Copy link
Author

jt-tbc commented Feb 27, 2023

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
Copy link
Collaborator

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
Copy link
Contributor

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

@kguidonimartins
Copy link
Collaborator

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.

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

3 participants