get_data: Get data from specified table based on specified query...

Description Usage Arguments Value Author(s) Examples

View source: R/get_data.R

Description

Get data from specified table based on specified query parameters

Usage

 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
get_data(
  tbl_name,
  .source = NULL,
  ccode = NULL,
  .start = NULL,
  .end = Sys.Date(),
  adm = NULL
)

get_data_epidemiology(
  .source = NULL,
  ccode = NULL,
  .start = NULL,
  .end = Sys.Date(),
  adm = NULL
)

get_data_weather(
  .source = NULL,
  ccode = NULL,
  .start = NULL,
  .end = Sys.Date(),
  adm = NULL
)

get_data_mobility(
  .source = NULL,
  ccode = NULL,
  .start = NULL,
  .end = Sys.Date(),
  adm = NULL
)

get_data_response(ccode = NULL, .start = NULL, .end = Sys.Date(), adm = NULL)

Arguments

tbl_name

Name of table available in OxCOVID19 Database. Should be one of the table names given by a call to list_tables().

.source

Source of data. Should be specified as per source code shown in data_sources for specified table. Default is NULL which returns data from specified table from all data sources.

ccode

A character value of country name specified as either a two character ISO country code, or a three character ISO country code, or any of the country names specified in the countrycode package, or a vector of country names using a combination of these country name variants. Defaults to NULL which returns data for all countries in the database.

.start

Starting date (in YYYY-MM-DD character format) of data to retrieve. Defaults to NULL which returns data from the earliest date available.

.end

End date (in YYYY-MM-DD character format) of data to retrieve. Defaults to current date as speciifed by Sys.Date().

adm

Numeric value for administrative level data required. Possible values are 0 for whole country, 1 for administrative level 1, 2 for administrative level 2 and 3 for administrative level 3. Default is NULL which returns data for all administrative divisions.

Value

A tibble of specified table dataset based on specified parameters. If all parameters are kept to default, output is the same as that when get_table() is used with tbl_name based on specified table. However, this function will retrieve the full data into a local tibble which will take considerable time. It is therefore recommended that this function be used when the specific data requirements are already clearly determined. For data exploration, get_table() should be used instead.

Author(s)

Ernest Guevarra

Examples

 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
## Get epidemiology data for the the whole of the UK from the ECDC for all
## available dates
get_data(tbl_name = "epidemiology",
         .source = "WRD_ECDC",
         ccode = "GBR",
         adm = 0)

## Get epidemiology data for the the whole of the UK from the ECDC for all
## available dates
get_data_epidemiology(.source = "WRD_ECDC",
                      ccode = "UK",
                      adm = 0)

## Get weather data for the the whole of the UK for all available dates
get_data_weather(ccode = "GBR",
                 adm = 0)

## Get mobility data for the the whole of the UK from Apple for all
## available dates
get_data_mobility(.source = "APPLE_MOBILITY",
                  ccode = "United Kingdom",
                  adm = 0)

## Get government response data for the the whole of the UK for all
## available dates
get_data_response(ccode = "UK",
                  adm = 0)

oxcovid19 documentation built on Jan. 13, 2021, 8:50 p.m.