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

FAQ #243

Closed kguidonimartins closed 3 months ago

kguidonimartins commented 1 year ago

This is a pinned issue, listing the most common errors that we observed in the previous issues.

1. Error in utils::download.file... after running bdc_clean_names()

Complete error message below:

Error in utils::download.file(grep(os, urls, value = TRUE), file, mode = "wb") : 
  lengths of 'url' and 'destfile' must match

On Windows systems, you can resolve by running options(download.file.method = "wininet") before bdc_clean_names().

For example:

options(download.file.method = "wininet")
my_clean_names <- bdc_clean_names(my_species_names)

See: https://github.com/brunobrr/bdc/issues/230#issuecomment-1333589542

2. Error: rapi_startup: Failed to open database... after running bdc_query_names_taxadb()

Complete error message below:

Error: rapi_startup: Failed to open database: IO Error: Trying to read a database file with version number 31, but we can only read version 33.
The database file was created with an older version of DuckDB.

The storage of DuckDB is not yet stable; newer versions of DuckDB cannot read old database files and vice versa.
The storage will be stabilized when version 1.0 releases.

For now, we recommend that you load the database file in a supported version of DuckDB, and use the EXPORT DATABASE command followed by IMPORT DATABASE on the current version of DuckDB.

You can solve this by deleting previous database version with fs::dir_delete(taxadb:::taxadb_dir()) and running your query again.

For example:

fs::dir_delete(taxadb:::taxadb_dir())
my_query_names <- bdc_query_names_taxadb(sci_name = my_species_names, db = "itis", suggestion_distance = 0.9)

See: https://github.com/brunobrr/bdc/issues/233#issuecomment-1199893394

kguidonimartins commented 3 months ago

These problems do not seem to occur in recent versions of the bdc. I will close this FAQ for now.