View source: R/download_covid.R
download_covid | R Documentation |
Downloads one of the COVerAGE-DB datasets hosted on OSF. It reads the downloaded data and converts it into a data frame.
download_covid( data = c("inputDB", "Output_5", "Output_10", "qualityMetrics"), dest = getwd(), temp = FALSE, download_only = FALSE, return = c("data.frame", "data.table", "tibble"), progress = TRUE, conflicts = "overwrite", recurse = FALSE, verbose = FALSE, ... ) download_covid_version( data = c("inputDB", "Output_5", "Output_10", "qualityMetrics"), version, dest = getwd(), temp = FALSE, download_method = "auto", download_only = FALSE, return = c("data.frame", "data.table", "tibble"), progress = TRUE, ... )
data |
The name of the dataset to download. Can be one of the the following: "inputDB", "Output_5", "Output_10", "qualityMetrics". |
dest |
Character. If 'temp' is set to FALSE, specifies the directory the dataset should be downloaded to. By default, the current working directory. |
temp |
Logical. Should the dataset be downloaded to a temporary directory? |
download_only |
Logical. Should the dataset be downloaded without reading it |
return |
What should be the return type? Can be on of the following: "data.frame", "data.table", "tibble". |
progress |
Passed to |
conflicts |
Passed to
|
recurse |
Passed to |
verbose |
Passed to |
... |
Additional named arguments passed to |
version |
Integer. Which file version to download? |
download_method |
Passed to |
These functions use the OSF API to download the
publicly available COVerAGE-DB
datasets. It then returns the downloaded dataset as a data frame, data table,
or tibble. download_covid()
Uses the osfr package as a backend.
download_covid_version()
uses utils::download.file()
to download the
specific requested file version.
There are 4 possible datasets available for download: "inputDB", "Output_5",
"Output_10", "qualityMetrics".
See https://timriffe.github.io/covid_age/GettingStarted.html for more
information about these datasets.
If the download times out, consider increasing the 'timeout' option in
options()
By default a data frame with the uncompressed dataset. Can be set to return either a data table or a tibble. The return type is controlled by the 'return' parameter. If 'download_only' is set to TRUE, the function will invisibly return NULL after downloading the dataset.
Erez Shomron
osfr::osf_retrieve()
for the OSF entity retrieval function;
osfr::osf_download()
for the downloading function;
data.table::fread()
for
the reading function.
## Not run: # Basic usage df <- download_covid("inputDB") # Download data to the working directory. df <- download_covid("Output_5", temp = FALSE) # If you want a tibble instead of a data frame: df <- download_covid("Output_10", return = "tibble") # Get the first 'inputDB' version df <- download_covid_version("InputDB", version = 1) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.