Get JSON for OxCGRT data

get_json_time(from = "2020-01-02", to = Sys.Date())

get_json_actions(ccode, from = "2020-01-02", to = Sys.Date())

Arguments

from

Start date for stringency index data to be collected. This can go as far back as 2020-01-02 (Default). Format YYYY-MM-DD. Accepts either character string or date class.

to

End date for stringency index data to be collected. This defaults to current date. Format YYYY-MM-DD. Accepts either character string or date class.

ccode

ISO 3166-1 alpha-2 country code, alpha-3 country code, or full country name string or vector of strings (mix of alpha-2 code or alpha-3 code or country names is valid).

Value

A character object for specified JSON time series endpoint, or a character string or a character vector for specified JSON policy actions endpoint or endpoints.

Author

Ernest Guevarra

Examples

## Get JSON for Afghanistan at 7 days previous to current date
get_json_actions(ccode = "AFG",
                 from = NULL,
                 to = as.character(Sys.Date() - 7))
#> [1] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2022-03-20"

## Get JSON for Afghanistan and Philippines from 1 October to 31 October 2020
get_json_actions(ccode = c("Afghanistan", "PH"),
                 from = "2020-10-01", to = "2020-10-31")
#>  [1] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-01"
#>  [2] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-02"
#>  [3] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-03"
#>  [4] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-04"
#>  [5] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-05"
#>  [6] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-06"
#>  [7] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-07"
#>  [8] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-08"
#>  [9] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-09"
#> [10] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-10"
#> [11] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-11"
#> [12] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-12"
#> [13] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-13"
#> [14] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-14"
#> [15] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-15"
#> [16] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-16"
#> [17] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-17"
#> [18] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-18"
#> [19] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-19"
#> [20] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-20"
#> [21] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-21"
#> [22] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-22"
#> [23] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-23"
#> [24] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-24"
#> [25] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-25"
#> [26] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-26"
#> [27] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-27"
#> [28] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-28"
#> [29] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-29"
#> [30] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-30"
#> [31] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/AFG/2020-10-31"
#> [32] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-01"
#> [33] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-02"
#> [34] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-03"
#> [35] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-04"
#> [36] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-05"
#> [37] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-06"
#> [38] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-07"
#> [39] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-08"
#> [40] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-09"
#> [41] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-10"
#> [42] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-11"
#> [43] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-12"
#> [44] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-13"
#> [45] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-14"
#> [46] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-15"
#> [47] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-16"
#> [48] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-17"
#> [49] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-18"
#> [50] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-19"
#> [51] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-20"
#> [52] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-21"
#> [53] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-22"
#> [54] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-23"
#> [55] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-24"
#> [56] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-25"
#> [57] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-26"
#> [58] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-27"
#> [59] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-28"
#> [60] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-29"
#> [61] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-30"
#> [62] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/actions/PHL/2020-10-31"

## Get JSON time series endpoint for all data available from OxCGRT
get_json_time()
#> [1] "https://covidtrackerapi.bsg.ox.ac.uk/api/v2/stringency/date-range/2020-01-02/2022-03-27"