This function downloads data for a specified species from the EASIN database. It handles pagination automatically, downloading data in chunks until all available data for the species is retrieved. The function also supports pausing between requests to avoid overloading the server.
Usage
EASIN_Down(
SpKey,
Timeout = 200,
Verbose = FALSE,
BaseURL = "https://easin.jrc.ec.europa.eu/apixg/geoxg",
NSearch = 1000,
Attempts = 10,
SleepTime = 5,
Path_Raw = "datasets/interim/EASIN",
DeleteChunks = TRUE,
ReturnData = FALSE
)
Arguments
- SpKey
character; the EASIN taxon ID for which data is to be retrieved. This parameter cannot be
NULL
.- Timeout
integer; time in seconds before a download attempt times out. Default is 200.
- Verbose
logical. Indicating whether to print messages for the progress of the function
- BaseURL
character; the base URL for downloading EASIN data. Default is "https://easin.jrc.ec.europa.eu/apixg/geoxg".
- NSearch
the number of records to attempt to retrieve per request. Default is 1000, which is the current maximum allowed by the API.
- Attempts
integer; maximum number of download attempts per data chunk. Defaults to 10.
- SleepTime
integer; the number of seconds to pause between each data retrieval request to prevent overloading the server. Default is 5 second.
- Path_Raw
character; the path where the raw data files and temporary parts will be stored. Default is
datasets/interim/EASIN
.- DeleteChunks
logical, indicating whether to delete temporary files for data chunks from the
FileParts
subdirectory. Defaults toTRUE
.- ReturnData
logical; if
TRUE
, the function will return the combined data as a dataframe. IfFALSE
(default), the data will only be saved to disk and the function will invisibly returnNULL
.
Value
If ReturnData
is TRUE
, returns a dataframe containing all the
data retrieved for the specified EASIN ID. If ReturnData
is FALSE
,
returns NULL
.
Details
This function extracts EASIN data for a given EASIN_ID, handles pagination, and ensures that data retrieval is efficient by managing retries and pauses.
Note
This function is not intended to be used directly by the user or in the IAS-pDT, but only used inside the EASIN_Process function.