compiled at 2018-02-05 16:08:38

Download data from the Quality of Government Institute data

Quotation from Quality of Governance institute website

The QoG Institute was founded in 2004 by Professor Bo Rothstein and Professor Sören Holmberg. It is an independent research institute within the Department of Political Science at the University of Gothenburg. We conduct and promote research on the causes, consequences and nature of Good Governance and the Quality of Government (QoG) - that is, trustworthy, reliable, impartial, uncorrupted and competent government institutions.

The main objective of our research is to address the theoretical and empirical problem of how political institutions of high quality can be created and maintained. A second objective is to study the effects of Quality of Government on a number of policy areas, such as health, the environment, social policy, and poverty. We approach these problems from a variety of different theoretical and methodological angles.

Quality of Government institute provides data in five different data sets, both in cross-sectional and longitudinal versions:

  1. QoG Basic Data
  2. QoG Standard Data
  3. QoG OECD Data
  4. QoG Expert Survey Data
  5. QoG EU Regional Data

rqog-package provides access to Basic, Standard and OECD datasets through function read_qog(). Standard data has all the same indicators as in Basic data (367 variables) and an additional ~1600 indicators. Both basic and standard datasets have 194 countries. OECD dataset has 1020 indicators from 35 countries. rqog uses longitudinal datasets by default that have time-series of varying duration from majority of the indicators and countries.

Quality of Government Institute provides codebooks for all datasets:

  1. Basic data codebook
  2. Standard data codebook
  3. OECD data codebook

You consult the codebooks for description of the data and indicators.

Installation

Examples

Download data and plot numeric indicators

Basic Data

Basic data has a selection of most common indicators, 344 indicators from 211 countries. Below is an example on how to extract data on population and Democracy (Freedom House/Polity) index from BRIC-countries from 1990 to 2010 and to plot it.

Standard data

Standard data includes 2190 indicators from 211 countries. Below is an example on how to extract data on Environmental Performance Index and Party of Chief Executive: How Long in Office from BRIC-countries and plot it.

OECD data

OECD data includes 1006 variables, but from a smaller number of wealthier countries of 36. In the example below four indicators:

  1. Total health expenditure (public) wdi_exph
  2. Income inequality: GINI index (World Bank estimate) wdi_gini
  3. Gross National Income per Capita oecd_natinccap_t1
  4. Government gross debt (Percent of GDP) imf_gd

We will include all the countries and all the years included in the data.

Work with metadata and factor indicators

Packages is shipped with six metadatas meta_basic_cs, meta_basic_ts, meta_std_cs, meta_std_ts, meta_oecd_cs and meta_oecd_ts. Data frames are generated from original spss versions of data using tidymetadata::create_metadata()-function.

Browsing metadata

You can browse the content by applying grepl to name column. Let’s find indicators containing term Corruption either in lower or uppercase.

## # A tibble: 10 x 5
##    code       name                           value label             class
##    <chr>      <chr>                          <dbl> <chr>             <chr>
##  1 bci_bci    The Bayesian Corruption Indic… NA    <NA>              nume…
##  2 ccp_cc     Corruption Commission Present…  1.00 1. Yes            fact…
##  3 ccp_cc     Corruption Commission Present…  2.00 2. No             fact…
##  4 ccp_cc     Corruption Commission Present… 90.0  90. left explici… fact…
##  5 ccp_cc     Corruption Commission Present… 96.0  96. Other         fact…
##  6 ccp_cc     Corruption Commission Present… 97.0  97. Unable to de… fact…
##  7 ti_cpi     Corruption Perceptions Index   NA    <NA>              nume…
##  8 vdem_corr  Political corruption index     NA    <NA>              nume…
##  9 wbgi_cce   Control of Corruption, Estima… NA    <NA>              nume…
## 10 wdi_tacpsr CPIA transparency-accountabil… NA    <NA>              nume…

Assigning labels to values with metadata

The data rqoq imports to R is in .csv-format without the labels and names shipped together with spss or Stata formats. As such it is the desired format to work with in R, especially with numeric indicators. However, many of the indicators in QoG are factors meaning that they have discrete values with a corresponding label. You can use the metadatas to assign labels for values of such indicators. Lets take the ccp_cc as an example below and first print the value and label colums of the data.

## # A tibble: 5 x 2
##   value label                                  
##   <dbl> <chr>                                  
## 1  1.00 1. Yes                                 
## 2  2.00 2. No                                  
## 3 90.0  90. left explicitly to non-constitution
## 4 96.0  96. Other                              
## 5 97.0  97. Unable to determine

Currently we have basic data in R in an object called basic. Lets see the frequencies of each value

## # A tibble: 4 x 2
##   ccp_cc     n
##    <int> <int>
## 1      1   270
## 2      2  5472
## 3     96   111
## 4     NA  9339

Now, using the metadata with assign values with corresponding labels

## # A tibble: 4 x 3
##   ccp_cc     n ccp_cc_lab
##    <int> <int> <chr>     
## 1      1   270 1. Yes    
## 2      2  5472 2. No     
## 3     96   111 96. Other 
## 4     NA  9339 <NA>

A more straighforward method is by using tidymetadata::label_data() -function like this.

library(tidymetadata)
basic %>% 
  count(ccp_cc) %>% 
  mutate(ccp_cc_lab = label_data(data = ., variable.data = "ccp_cc", metadata = meta_basic_ts))
## # A tibble: 4 x 3
##   ccp_cc     n ccp_cc_lab
##    <int> <int> <fct>     
## 1      1   270 1. Yes    
## 2      2  5472 2. No     
## 3     96   111 96. Other 
## 4     NA  9339 <NA>

So, lets find two factor variables with few more values from the cross-sectional data

## # A tibble: 37 x 2
##    code         n_of_values
##    <chr>              <int>
##  1 gol_pr                28
##  2 ht_regtype            20
##  3 ht_regtype1           13
##  4 gol_est_spec          12
##  5 ht_colonial           11
##  6 ht_region             10
##  7 cpds_tg                7
##  8 ccp_slave              6
##  9 ccp_cc                 5
## 10 ccp_childwrk           5
## # ... with 27 more rows

Lets take these two factors and summarise the regime types per regions

## # A tibble: 2 x 5
##   code       name                      value label                   class
##   <chr>      <chr>                     <dbl> <chr>                   <chr>
## 1 ht_region  The Region of the Country  1.00 1. Eastern Europe and … fact…
## 2 ht_regtype Regime Type                1.00 limited multiparty      fact…
## # A tibble: 6 x 5
##   ht_region ht_regtype     n ht_region_lab                ht_regtype_lab  
##       <int>      <int> <int> <fct>                        <fct>           
## 1         1          1     9 1. Eastern Europe and post … limited multipa…
## 2         1          8     2 1. Eastern Europe and post … one-party       
## 3         1        100    16 1. Eastern Europe and post … democracy       
## 4         2          1     3 2. Latin America             limited multipa…
## 5         2          8     1 2. Latin America             one-party       
## 6         2        100    16 2. Latin America             democracy

Then we can create a simple bar plot

##  setting  value                       
##  version  R version 3.4.3 (2017-11-30)
##  system   x86_64, linux-gnu           
##  ui       X11                         
##  language (EN)                        
##  collate  fi_FI.UTF-8                 
##  tz       Europe/Mariehamn            
##  date     2018-02-05                  
## 
##  package      * version    date      
##  assertthat     0.2.0      2017-04-11
##  backports      1.1.2      2017-12-13
##  base         * 3.4.3      2017-12-01
##  bindr          0.1        2016-11-13
##  bindrcpp     * 0.2        2017-06-17
##  broom          0.4.3      2017-11-20
##  cellranger     1.1.0      2016-07-27
##  cli            1.0.0      2017-11-05
##  colorspace     1.3-2      2016-12-14
##  compiler       3.4.3      2017-12-01
##  crayon         1.3.4      2017-09-16
##  datasets     * 3.4.3      2017-12-01
##  devtools       1.13.4     2017-11-09
##  digest         0.6.15     2018-01-28
##  dplyr        * 0.7.4      2017-09-28
##  evaluate       0.10.1     2017-06-24
##  extrafont      0.17       2014-12-08
##  extrafontdb    1.0        2012-06-11
##  forcats      * 0.2.0      2017-01-23
##  foreign        0.8-69     2017-06-21
##  ggplot2      * 2.2.1.9000 2018-02-02
##  glue           1.2.0      2017-10-29
##  graphics     * 3.4.3      2017-12-01
##  grDevices    * 3.4.3      2017-12-01
##  grid           3.4.3      2017-12-01
##  gtable         0.2.0      2016-02-26
##  haven          1.1.0      2017-07-09
##  hms            0.4.0      2017-11-23
##  hrbrthemes   * 0.5.0      2018-02-02
##  htmltools      0.3.6      2017-04-28
##  httr           1.3.1      2017-08-20
##  jsonlite       1.5        2017-06-01
##  knitr          1.19       2018-01-29
##  labeling       0.3        2014-08-23
##  labelled     * 1.0.0      2016-11-20
##  lattice        0.20-35    2017-03-25
##  lazyeval       0.2.1      2017-10-29
##  lubridate      1.7.1      2017-11-03
##  magrittr       1.5        2014-11-22
##  memoise        1.1.0      2017-04-21
##  methods      * 3.4.3      2017-12-01
##  mnormt         1.5-5      2016-10-15
##  modelr         0.1.1      2017-07-24
##  munsell        0.4.3      2016-02-13
##  nlme           3.1-131    2017-02-06
##  parallel       3.4.3      2017-12-01
##  pillar         1.1.0      2018-01-14
##  pkgconfig      2.0.1      2017-03-21
##  plyr           1.8.4      2016-06-08
##  psych          1.7.8      2017-09-09
##  purrr        * 0.2.4      2017-10-18
##  R6             2.2.2      2017-06-17
##  Rcpp           0.12.14    2017-11-23
##  readr        * 1.1.1      2017-05-16
##  readxl         1.0.0      2017-04-18
##  reshape2       1.4.3      2017-12-11
##  rlang          0.1.6.9003 2018-02-02
##  rmarkdown      1.8        2017-11-17
##  rprojroot      1.3-2      2018-01-03
##  rqog         * 0.2.4      2018-02-05
##  rstudioapi     0.7        2017-09-07
##  Rttf2pt1       1.3.5      2017-12-04
##  rvest          0.3.2      2016-06-17
##  scales         0.5.0.9000 2018-02-02
##  stats        * 3.4.3      2017-12-01
##  stringi        1.1.6      2017-11-17
##  stringr      * 1.2.0      2017-02-18
##  tibble       * 1.4.2      2018-01-22
##  tidymetadata * 0.2.0      2017-12-05
##  tidyr        * 0.7.2      2017-10-16
##  tidyselect     0.2.3      2017-11-06
##  tidyverse    * 1.2.1      2017-11-14
##  tools          3.4.3      2017-12-01
##  utf8           1.1.3      2018-01-03
##  utils        * 3.4.3      2017-12-01
##  withr          2.1.1.9000 2018-02-02
##  xml2           1.2.0      2018-01-24
##  yaml           2.1.16     2017-12-12
##  source                                   
##  CRAN (R 3.4.0)                           
##  cran (@1.1.2)                            
##  local                                    
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  local                                    
##  CRAN (R 3.4.2)                           
##  local                                    
##  CRAN (R 3.4.2)                           
##  cran (@0.6.15)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.1)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  Github (tidyverse/ggplot2@a2dc248)       
##  CRAN (R 3.4.2)                           
##  local                                    
##  local                                    
##  local                                    
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.1)                           
##  CRAN (R 3.4.2)                           
##  Github (hrbrmstr/hrbrthemes@b2ce784)     
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.1)                           
##  CRAN (R 3.4.0)                           
##  cran (@1.19)                             
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.3.3)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  local                                    
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.1)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  local                                    
##  cran (@1.1.0)                            
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  CRAN (R 3.4.0)                           
##  cran (@1.4.3)                            
##  Github (hadley/rlang@c6747f9)            
##  CRAN (R 3.4.2)                           
##  cran (@1.3-2)                            
##  local                                    
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  Github (hadley/scales@d767915)           
##  local                                    
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.0)                           
##  cran (@1.4.2)                            
##  Github (muuankarski/tidymetadata@a907a38)
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.2)                           
##  CRAN (R 3.4.2)                           
##  local                                    
##  cran (@1.1.3)                            
##  local                                    
##  Github (jimhester/withr@df18523)         
##  cran (@1.2.0)                            
##  cran (@2.1.16)