Download survey
retrieve_survey.Rd
Download multiple survey artefacts (data and metadata) at once. Progress through the function is tracked using the package logger.
Usage
retrieve_survey(
prefix,
api,
id,
token,
format = c("csv", "json"),
metadata = TRUE,
append_version = TRUE
)
Arguments
- prefix
name to be used as the prefix of the file names to be downloaded. Can be a path.
- api
Either "kobo", "kobohr", "ona", or a custom (full) URL. API URLs are made available for KoBo Toolbox ("kobo", https://kc.kobotoolbox.org/api/v1/), KoBo Humanitarian Response ("kobohr", https://kc.humanitarianresponse.info/api/v1/), Ona ("ona", https://api.ona.io/api/v1/) and Unhcr ("unhcr", https://kobocat.unhcr.org/api/v1/) . For your own installation, or other installations using the same API but accessed at a different URL, enter the full URL.
- id
survey id. Usually a 6 digit number. See this support page for an example on how this can be obtained
- token
access token for the account e.g. "Token XXXXXXX"
- format
Either "csv" or "json"
- metadata
whether to download metadata as well as data
- append_version
whether to append versioning information to the filename using add_version.
Examples
if (FALSE) { # \dontrun{
# It's only possible to donwload survey metadata with the account Token
retrieve_survey(
prefix = "my-survey", api = "kobohr", id = 753491,
token = "123XXXXXX"
)
# To download in a different path
dir.create("my-data-dir")
retrieve_survey(
prefix = "my-data-dir/my-survey", api = "kobohr", id = 753491,
token = "123XXXXXX"
)
} # }