Get policy actions and stringency data from JSON
get_data(json)
A JSON string, URL or file created using get_json_time()
or
get_json_actions()
.
A tibble of time series stringency index data if json
is a time
series endpoint or a named list of two tibbles (the first tibble is
named policyActions
and the second tibble is named stringencyData
) if
json
is a policy actions endpoint.
## Get time series JSON endpoint
x <- get_json_time(from = "2020-10-29", to = "2020-10-31")
## Get time series stringency index data
get_data(x)
#> # A tibble: 555 × 8
#> date_value country_code confirmed deaths stringency_actual stringency
#> <date> <chr> <int> <int> <dbl> <dbl>
#> 1 2020-10-29 FIN 15988 349 40.7 40.7
#> 2 2020-10-29 DNK 44034 716 39.8 39.8
#> 3 2020-10-29 LBN 77778 610 57.4 57.4
#> 4 2020-10-29 GUY 4098 123 72.2 72.2
#> 5 2020-10-29 PSE 52571 473 40.7 40.7
#> 6 2020-10-29 AFG 41145 1529 9.26 9.26
#> 7 2020-10-29 SVK 53156 200 73.2 73.2
#> 8 2020-10-29 VEN 91280 789 88.0 88.0
#> 9 2020-10-29 HKG 5313 105 51.8 51.8
#> 10 2020-10-29 VNM 1177 35 58.3 58.3
#> # … with 545 more rows, and 2 more variables: stringency_legacy <dbl>,
#> # stringency_legacy_disp <dbl>
## Get policy actions JSON endpoint
x <- get_json_actions(ccode = "AFG", from = NULL, to = "2020-07-16")
## Get data on policy actions and stringency index
get_data(x)
#> $policyActions
#> # A tibble: 23 × 9
#> policy_type_code policy_type_display policyvalue policyvalue_act… flagged
#> <chr> <chr> <int> <int> <lgl>
#> 1 C1 School closing 3 3 TRUE
#> 2 C2 Workplace closing 3 3 FALSE
#> 3 C3 Cancel public events 2 2 TRUE
#> 4 C4 Restrictions on gather… 4 4 TRUE
#> 5 C5 Close public transport 2 2 FALSE
#> 6 C6 Stay at home requireme… 2 2 FALSE
#> 7 C7 Restrictions on intern… 2 2 FALSE
#> 8 C8 International travel c… 1 1 NA
#> 9 E1 Income support 0 0 NA
#> 10 E2 Debt/contract relief 0 0 NA
#> # … with 13 more rows, and 4 more variables: is_general <lgl>, notes <chr>,
#> # flag_value_display_field <chr>, policy_value_display_field <chr>
#>
#> $stringencyData
#> # A tibble: 1 × 6
#> date_value country_code confirmed deaths stringency_actual stringency
#> <chr> <chr> <int> <int> <dbl> <dbl>
#> 1 2020-07-16 AFG 35156 1117 78.7 78.7
#>