download_ecotox_data: Download and extract ECOTOX database files and compose...

View source: R/init.r

download_ecotox_dataR Documentation

Download and extract ECOTOX database files and compose database


[Stable] In order for this package to fully function, a local copy of the ECOTOX database needs to be build. This function will download the required data and build the database.


  target = get_ecotox_path(),
  write_log = TRUE,
  ask = TRUE,
  verify_ssl = getOption("ECOTOXr_verify_ssl"),



Target directory where the files will be downloaded and the database compiled. Default is get_ecotox_path().


A logical value indicating whether a log file should be written to the target path TRUE.


There are several steps in which files are (potentially) overwritten or deleted. In those cases the user is asked on the command line what to do in those cases. Set this parameter to FALSE in order to continue without warning and asking.


When set to FALSE the SSL certificate of the host (EPA) is not verified. Can also be set as option: options(ECOTOXr_verify_ssl = TRUE). Default is TRUE.


Arguments passed on to httr::GET().


This function will attempt to find the latest download url for the ECOTOX database from the EPA website (see get_ecotox_url()). When found it will attempt to download the zipped archive containing all required data. This data is then extracted and a local copy of the database is build.

Use 'suppressMessages()' to suppress the progress report.


Returns NULL invisibly.

Known issues

On some machines this function fails to connect to the database download URL from the EPA website due to missing SSL certificates. Unfortunately, there is no easy fix for this in this package. A work around is to download and unzip the file manually using a different machine or browser that is less strict with SSL certificates. You can then call build_ecotox_sqlite() and point the source location to the manually extracted zip archive. For this purpose get_ecotox_url() can be used. Alternatively, one could try to call download_ecotox_data() by setting verify_ssl = FALSE; but only do so when you trust the download URL from get_ecotox_URL().


Pepijn de Vries


## Not run: 
## This will download and build the database in your temp dir:

## End(Not run)

ECOTOXr documentation built on Oct. 10, 2023, 1:05 a.m.