-
Notifications
You must be signed in to change notification settings - Fork 6
/
get_data.Rd
61 lines (49 loc) · 2.38 KB
/
get_data.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_data.R
\name{get_data}
\alias{get_data}
\title{Generic Get Data Function}
\usage{
get_data(url = NULL, data_trans_fn = NULL, download_data = TRUE,
save = TRUE, save_name = NULL, return = TRUE, verbose = TRUE,
use_utils = FALSE, use_direct_download = FALSE,
retry_download = TRUE)
}
\arguments{
\item{url}{Character string, indicating the url of the data to download.}
\item{data_trans_fn}{Function that takes a data.table as input and returns a single
dataframe of any type. If not specified defaults to transforming the data into a tibble.}
\item{download_data}{Logical, defaults to \code{TRUE}. If not found locally should the data be
downloaded from the specified URL?}
\item{save}{Logical, should the data be saved for reuse during the current R session. Defaults to
\code{TRUE}. If \code{TRUE} then the data is saved to the temporary directory specified by \code{\link[base]{tempdir}}.}
\item{save_name}{Character string, name to save the data under. Defaults to
\code{NULL}.}
\item{return}{Logical, should the data be returned as a dataframe.
Defaults to \code{TRUE}.}
\item{verbose}{Logical, defaults to \code{TRUE}. Should additional status and progress messages
be displayed.}
\item{use_utils}{Logical, defaults to \code{FALSE}. Used for testing alternative
data download function. When \code{TRUE} data is downloaded using \code{read.csv}.}
\item{use_direct_download}{Logical, defaults to \code{FALSE}. Used for testing alternative
data download function. When \code{TRUE} data is downloaded using \code{download.file}.}
\item{retry_download}{Logical defaults to \code{TRUE}. When \code{TRUE}, if downloading
fails, the function will try repeatedly to download the data within 3 seconds, up
to 3 times.}
}
\value{
The data loaded from a local copy or downloaded from the given url as a dataframe, exact format specified by data_trans_fn
}
\description{
If the data is found locally in the temporary directory then this function will load the data into R.
Otherwise if \code{download_data = TRUE} then the data will be retrieved from the specified URL. Data can then be
saved to the temporary directory by specifying \code{save = TRUE}.
}
\examples{
tb_burden <- get_data(url = "https://extranet.who.int/tme/generateCSV.asp?ds=estimates",
save_name = "TB_burden")
head(tb_burden)
}
\seealso{
get_tb_burden get_data_dict
}