Skip to contents

Get policy actions data from JSON

Usage

get_data_action(json)

get_data_actions(json)

Arguments

json

A JSON string, URL or file created using get_json_actions() or a vector of JSON strings or URLs.

Value

A tibble of policy actions with their respective policy values for specified country/countries and specified date/dates.

Examples

## Get relevant JSON for Afghanistan on 16 July 2020
x <- get_json_actions(ccode = "AFG", from = NULL, to = "2020-07-16")

## Get data on policy actions
get_data_action(x)
#> # A tibble: 23 × 12
#>    date_value country_code country_name policy_type_code policy_type_display    
#>    <date>     <chr>        <chr>        <chr>            <chr>                  
#>  1 2020-07-16 AFG          Afghanistan  C1               School closing         
#>  2 2020-07-16 AFG          Afghanistan  C2               Workplace closing      
#>  3 2020-07-16 AFG          Afghanistan  C3               Cancel public events   
#>  4 2020-07-16 AFG          Afghanistan  C4               Restrictions on gather…
#>  5 2020-07-16 AFG          Afghanistan  C5               Close public transport 
#>  6 2020-07-16 AFG          Afghanistan  C6               Stay at home requireme…
#>  7 2020-07-16 AFG          Afghanistan  C7               Restrictions on intern…
#>  8 2020-07-16 AFG          Afghanistan  C8               International travel c…
#>  9 2020-07-16 AFG          Afghanistan  E1               Income support         
#> 10 2020-07-16 AFG          Afghanistan  E2               Debt/contract relief   
#> # ℹ 13 more rows
#> # ℹ 7 more variables: policyvalue <int>, policyvalue_actual <int>,
#> #   flagged <lgl>, is_general <lgl>, notes <chr>,
#> #   flag_value_display_field <chr>, policy_value_display_field <chr>

## Get relevant JSON for Afghanistan and Philippines for whole month of
## October
x <- get_json_actions(ccode = c("AFG", "PH"),
                      from = "2020-10-29",
                      to = "2020-10-30")

## Get data on policy actions
get_data_actions(x)
#> # A tibble: 92 × 12
#>    date_value country_code country_name policy_type_code policy_type_display    
#>    <date>     <chr>        <chr>        <chr>            <chr>                  
#>  1 2020-10-29 AFG          Afghanistan  C1               School closing         
#>  2 2020-10-29 AFG          Afghanistan  C2               Workplace closing      
#>  3 2020-10-29 AFG          Afghanistan  C3               Cancel public events   
#>  4 2020-10-29 AFG          Afghanistan  C4               Restrictions on gather…
#>  5 2020-10-29 AFG          Afghanistan  C5               Close public transport 
#>  6 2020-10-29 AFG          Afghanistan  C6               Stay at home requireme…
#>  7 2020-10-29 AFG          Afghanistan  C7               Restrictions on intern…
#>  8 2020-10-29 AFG          Afghanistan  C8               International travel c…
#>  9 2020-10-29 AFG          Afghanistan  E1               Income support         
#> 10 2020-10-29 AFG          Afghanistan  E2               Debt/contract relief   
#> # ℹ 82 more rows
#> # ℹ 7 more variables: policyvalue <int>, policyvalue_actual <int>,
#> #   flagged <lgl>, is_general <lgl>, notes <chr>,
#> #   flag_value_display_field <chr>, policy_value_display_field <chr>