Get data from specified table based on specified query parameters

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

Ernest Guevarra

Examples

## 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)
#> # A tibble: 333 x 15 #> source date country countrycode adm_area_1 adm_area_2 adm_area_3 tested #> <chr> <date> <chr> <chr> <chr> <chr> <chr> <int> #> 1 WRD_E… 2019-12-31 United… GBR NA NA NA NA #> 2 WRD_E… 2020-01-01 United… GBR NA NA NA NA #> 3 WRD_E… 2020-01-02 United… GBR NA NA NA NA #> 4 WRD_E… 2020-01-03 United… GBR NA NA NA NA #> 5 WRD_E… 2020-01-04 United… GBR NA NA NA NA #> 6 WRD_E… 2020-01-05 United… GBR NA NA NA NA #> 7 WRD_E… 2020-01-06 United… GBR NA NA NA NA #> 8 WRD_E… 2020-01-07 United… GBR NA NA NA NA #> 9 WRD_E… 2020-01-08 United… GBR NA NA NA NA #> 10 WRD_E… 2020-01-09 United… GBR NA NA NA NA #> # … with 323 more rows, and 7 more variables: confirmed <int>, recovered <int>, #> # dead <int>, hospitalised <int>, hospitalised_icu <int>, quarantined <int>, #> # gid <pq__text>
## 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)
#> # A tibble: 333 x 15 #> source date country countrycode adm_area_1 adm_area_2 adm_area_3 tested #> <chr> <date> <chr> <chr> <chr> <chr> <chr> <int> #> 1 WRD_E… 2019-12-31 United… GBR NA NA NA NA #> 2 WRD_E… 2020-01-01 United… GBR NA NA NA NA #> 3 WRD_E… 2020-01-02 United… GBR NA NA NA NA #> 4 WRD_E… 2020-01-03 United… GBR NA NA NA NA #> 5 WRD_E… 2020-01-04 United… GBR NA NA NA NA #> 6 WRD_E… 2020-01-05 United… GBR NA NA NA NA #> 7 WRD_E… 2020-01-06 United… GBR NA NA NA NA #> 8 WRD_E… 2020-01-07 United… GBR NA NA NA NA #> 9 WRD_E… 2020-01-08 United… GBR NA NA NA NA #> 10 WRD_E… 2020-01-09 United… GBR NA NA NA NA #> # … with 323 more rows, and 7 more variables: confirmed <int>, recovered <int>, #> # dead <int>, hospitalised <int>, hospitalised_icu <int>, quarantined <int>, #> # gid <pq__text>
## Get weather data for the the whole of the UK for all available dates get_data_weather(ccode = "GBR", adm = 0)
#> # A tibble: 0 x 56 #> # … with 56 variables: source <chr>, date <date>, gid <chr>, country <chr>, #> # countrycode <chr>, adm_area_1 <chr>, adm_area_2 <chr>, adm_area_3 <chr>, #> # samplesize <int>, precipitation_max_avg <dbl>, precipitation_max_std <dbl>, #> # precipitation_mean_avg <dbl>, precipitation_mean_std <dbl>, #> # humidity_max_avg <dbl>, humidity_max_std <dbl>, humidity_mean_avg <dbl>, #> # humidity_mean_std <dbl>, humidity_min_avg <dbl>, humidity_min_std <dbl>, #> # sunshine_max_avg <dbl>, sunshine_max_std <dbl>, sunshine_mean_avg <dbl>, #> # sunshine_mean_std <dbl>, temperature_max_avg <dbl>, #> # temperature_max_std <dbl>, temperature_mean_avg <dbl>, #> # temperature_mean_std <dbl>, temperature_min_avg <dbl>, #> # temperature_min_std <dbl>, windgust_max_avg <dbl>, windgust_max_std <dbl>, #> # windgust_mean_avg <dbl>, windgust_mean_std <dbl>, windgust_min_avg <dbl>, #> # windgust_min_std <dbl>, windspeed_max_avg <dbl>, windspeed_max_std <dbl>, #> # windspeed_mean_avg <dbl>, windspeed_mean_std <dbl>, #> # windspeed_min_avg <dbl>, windspeed_min_std <dbl>, #> # cloudaltitude_max_valid <dbl>, cloudaltitude_max_avg <dbl>, #> # cloudaltitude_max_std <dbl>, cloudaltitude_min_valid <dbl>, #> # cloudaltitude_min_avg <dbl>, cloudaltitude_min_std <dbl>, #> # cloudaltitude_mean_valid <dbl>, cloudaltitude_mean_avg <dbl>, #> # cloudaltitude_mean_std <dbl>, cloudfrac_max_avg <dbl>, #> # cloudfrac_max_std <dbl>, cloudfrac_min_avg <dbl>, cloudfrac_min_std <dbl>, #> # cloudfrac_mean_avg <dbl>, cloudfrac_mean_std <dbl>
## 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)
#> # A tibble: 319 x 17 #> source date country countrycode adm_area_1 adm_area_2 adm_area_3 #> <chr> <date> <chr> <chr> <chr> <chr> <chr> #> 1 APPLE… 2020-01-13 United… GBR NA NA NA #> 2 APPLE… 2020-01-14 United… GBR NA NA NA #> 3 APPLE… 2020-01-15 United… GBR NA NA NA #> 4 APPLE… 2020-01-16 United… GBR NA NA NA #> 5 APPLE… 2020-01-17 United… GBR NA NA NA #> 6 APPLE… 2020-01-18 United… GBR NA NA NA #> 7 APPLE… 2020-01-19 United… GBR NA NA NA #> 8 APPLE… 2020-01-20 United… GBR NA NA NA #> 9 APPLE… 2020-01-21 United… GBR NA NA NA #> 10 APPLE… 2020-01-22 United… GBR NA NA NA #> # … with 309 more rows, and 10 more variables: transit_stations <dbl>, #> # residential <dbl>, workplace <dbl>, parks <dbl>, retail_recreation <dbl>, #> # grocery_pharmacy <dbl>, gid <pq__text>, transit <dbl>, walking <dbl>, #> # driving <dbl>
## Get government response data for the the whole of the UK for all ## available dates get_data_response(ccode = "UK", adm = 0)
#> # A tibble: 333 x 46 #> source date gid country countrycode adm_area_1 adm_area_2 adm_area_3 #> <chr> <date> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 GOVTR… 2020-01-01 GBR United… GBR NA NA NA #> 2 GOVTR… 2020-01-02 GBR United… GBR NA NA NA #> 3 GOVTR… 2020-01-03 GBR United… GBR NA NA NA #> 4 GOVTR… 2020-01-04 GBR United… GBR NA NA NA #> 5 GOVTR… 2020-01-05 GBR United… GBR NA NA NA #> 6 GOVTR… 2020-01-06 GBR United… GBR NA NA NA #> 7 GOVTR… 2020-01-07 GBR United… GBR NA NA NA #> 8 GOVTR… 2020-01-08 GBR United… GBR NA NA NA #> 9 GOVTR… 2020-01-09 GBR United… GBR NA NA NA #> 10 GOVTR… 2020-01-10 GBR United… GBR NA NA NA #> # … with 323 more rows, and 38 more variables: c1_school_closing <int>, #> # c1_flag <int>, c2_workplace_closing <int>, c2_flag <int>, #> # c3_cancel_public_events <int>, c3_flag <int>, #> # c4_restrictions_on_gatherings <int>, c4_flag <int>, #> # c5_close_public_transport <int>, c5_flag <int>, #> # c6_stay_at_home_requirements <int>, c6_flag <int>, #> # c7_restrictions_on_internal_movement <int>, c7_flag <int>, #> # c8_international_travel_controls <int>, e1_income_support <int>, #> # e1_flag <int>, e2_debtcontract_relief <int>, e3_fiscal_measures <dbl>, #> # e4_international_support <dbl>, h1_public_information_campaigns <int>, #> # h1_flag <int>, h2_testing_policy <int>, h3_contact_tracing <int>, #> # h4_emergency_investment_in_healthcare <dbl>, #> # h5_investment_in_vaccines <dbl>, m1_wildcard <chr>, stringency_index <dbl>, #> # stringency_indexfordisplay <dbl>, stringency_legacy_index <dbl>, #> # stringency_legacy_indexfordisplay <dbl>, government_response_index <dbl>, #> # government_response_index_for_display <dbl>, #> # containment_health_index <dbl>, containment_health_index_for_display <dbl>, #> # economic_support_index <dbl>, economic_support_index_for_display <dbl>, #> # actions <pq_jsonb>