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

Description

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.

Usage

download_ecotox_data(
  target = get_ecotox_path(),
  write_log = TRUE,
  ask = TRUE,
  ...
)

Arguments

target

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

write_log

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

ask

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.

...

Arguments passed on to GET. When this function fails with the error: "Peer certificate cannot be authenticated with given CA certificates", you could try to rerun the function with the option ssl_verifypeer = 0L. Only do so when you trust the indicated URL.

Details

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.

Value

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.

Author(s)

Pepijn de Vries

Examples

## Not run: 
## This will download and build the database in your temp dir:
download_ecotox_data(tempdir())

## End(Not run)

ECOTOXr documentation built on Nov. 17, 2022, 5:07 p.m.