View source: R/download_data.R
download_data | R Documentation |
Downloads the data for a specific user, species, and region into a
temporarly (or not) SQLite3 database. The data can be extracted
from this database via the extract_data()
function.
download_data(
session,
region,
speciesID,
token = session$unToken,
curl_handle = session$curl,
api_baseurl = session$base_url,
db_file = tempfile(),
end_point = "/api/data/download",
api_url = paste0(api_baseurl, end_point),
...,
debug_json = FALSE
)
session |
list, an object created by |
region |
integer, optional?? |
speciesID |
integer, optional?? |
token |
character, the token for the established session |
curl_handle |
a curl handle for the established session |
api_baseurl |
character, the base URL for the database API |
db_file |
character, the file to store the downloaded data in. Defaults to a temporary file. |
end_point |
character, the suffix for the download end point |
api_url |
character, the full url for the API end point for downloading data |
... |
additional arguments passed to |
debug_json |
logial, if TRUE the function returns the JSON
payload as a string and does not send the request. This is
primarily for debugging API behavior and checking the JSON
payloads for correctness. The JSON will include white space for
pretty printing, e.g. |
character, the file path to the downloaded SQLite
database, or when debug_json = TRUE
a string representing
the JSON payload.
Matt Espe
## Not run:
# All data
detection_db = download_data(my_session)
# One species
detection_db = dowloand(data(my_session, speciesID = 1)
# defaults to putting tables in an environment
detection_data = extract_data(detection_db)
# Access data via $
names(detection_data)
detection_data$Registrations
as.list(detection_data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.