rdb provides access to the Referendum Database (RDB) from R. This database aims to record all direct democratic votes worldwide and is operated by the Centre for Democracy Studies Aarau (ZDA) at the University of Zurich, Switzerland.
To install the latest development version of rdb, run the following in R:
Some of rdb’s functionality is controlled via package-specific global configuration which can either be set via R options or environment variables (the former take precedence). This configuration includes:
|Description||R option||Environment variable||Default value|
|RDB Services API username||
|RDB Services API password||
|Maximal timespan to preserve the package’s pkgpins cache. Cache entries older than this will be deleted upon package loading.||
|Whether or not to use the testing servers instead of the production servers for RDB Services API calls etc.||
|Whether or not to run the tests that use the testing servers for RDB Services API calls etc. during
This package’s source code is written in the R Markdown file format to facilitate practices commonly referred to as literate programming. It allows the actual code to be freely mixed with explanatory and supplementary information in expressive Markdown format instead of having to rely on
# comments only.
.gen.R suffixed R source code found under
R/ is generated from the respective R Markdown counterparts under
pkgpurl::purl_rmd()1. Always make changes only to the
.Rmd files – never the
.R files – and then run
pkgpurl::purl_rmd() to regenerate the R source files.
This package borrows a lot of the Tidyverse design philosophies. The R code adheres to the principles specified in the Tidyverse Design Guide wherever possible and is formatted according to the Tidyverse Style Guide (TSG) with the following exceptions:
Line width is limited to 160 characters, double the limit proposed by the TSG (80 characters is ridiculously little given today’s high-resolution wide screen monitors).
Furthermore, the preferred style for breaking long lines differs. Instead of wrapping directly after an expression’s opening bracket as suggested by the TSG, we prefer two fewer line breaks and indent subsequent lines within the expression by its opening bracket:
# TSG proposes this do_something_very_complicated( something = "that", requires = many, arguments = "some of which may be long" ) # we prefer this do_something_very_complicated(something = "that", requires = many, arguments = "some of which may be long")
This results in less vertical and more horizontal spread of the code and better readability in pipes.
As far as possible, these deviations from the TSG plus some additional restrictions are formally specified in
pkgpurl::default_linters, which is (by default) used in
pkgpurl::lint_rmd(), which in turn is the recommended way to lint this package.