In this vignette I introduce you to the basic functions of
the ecdata
package. You can download the latest stable
releases of the packages through CRAN and PyPi
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
load_ecd
The primary function that is shared across the Python and R
distributions of the package is the load_ecd
function. This
function accepts four primary arguments:
Argument | R Specific Quirks | Python Specific Quirks |
---|---|---|
country | A String/A String Vector | String, Dictionary, or List |
language | A String/A String Vector | String, Dictionary, or List |
full_ecd | A boolean if set to TRUE downloads full dataset. Defaults to FALSE | A boolean if set to True downloads full dataset. Defaults to False |
ecd_version | A character string of the ECD version you want to download. Defaults to latest version | A character string of the ECD version you want to download. Defaults to latest version |
Functionally the ecd_version
argument is not entirely
useful since there has only been one release of the data.
Say we only wanted data for South Korea1 we can simply set the country argument like this:
## ✔ Successfully downloaded Republic of Korea.
## # A tibble: 2 × 17
## country url text date title executive type language file
## <chr> <chr> <chr> <dttm> <chr> <chr> <chr> <chr> <chr>
## 1 Republic… http… 위대하… 2022-03-10 00:00:00 정직한 … Yoon Suk… Spee… Korean <NA>
## 2 Republic… http… 위대하… 2022-03-10 00:00:00 정직한 … Yoon Suk… Spee… Korean <NA>
## # ℹ 8 more variables: isonumber <dbl>, gwc <chr>, cowcodes <chr>,
## # polity_v <chr>, polity_iv <chr>, vdem <dbl>, year_of_statement <dbl>,
## # office <chr>
We implement caching by default so you will get a pretty shouty
warning every few hours in R. load_ecd
has some tolerance
for common names, abbreviations, and mixed punctuations of countries so
if we wanted to download the same data using RK
,
ROK
, or South Korea
these will all download
the South Korean data.
## ✔ Successfully downloaded Republic of Korea.
The same functionality is extended to the language argument too!
I choose South Korea because the underlying file is relatively small compared to some of the other country files.↩︎