qogdata: Get Quality of Government datasets in 'xtdata' format

Description Usage Arguments Details Author(s) See Also Examples

Description

Function to download Quality of Government (QOG) data and load it as a data frame in R. The result carries an xtdata attribute that can be passed to the xtmerge panel data method. Please visit the QOG Institute website at http://www.qog.pol.gu.se/ for a presentation of QOG research.

Usage

1
2
3
  qogdata(file = FALSE, replace = FALSE, codebook = FALSE,
    path = "", version = "std", format = "cs",
    variables = NULL, years = NULL, ...)

Arguments

file

a filename to save the dataset at. If set to FALSE (the default), the function just returns the link to the dataset. If set to TRUE, the server filename of the dataset is used, which returns either a CSV file if version is set to std, or a Stata dta file otherwise. See 'Details'.

replace

whether to overwrite the dataset even if a file already exists at the download location. Defaults to FALSE.

path

a folder path to prepend to the filename and to the codebook if codebook is not FALSE.

version

the QOG version: std (Standard), soc (Social Policy), bas (Basic) or exp (Expert). Defaults to std. See 'Details'.

format

the QOG format, usually cs for cross-sectional data or ts for time series in the std and bas versions. See 'Details' for the full list of specifications. Defaults to cs.

codebook

whether to download the codebook. Calls qogbook by passing the codebook, version and path arguments to it, where codebook is treated as the filename for the codebook. Defaults to FALSE.

variables

a selection of variables to import. ccode ISO-3N country codes ccode and year identifiers will be forced into the output if relevant.

years

a selection of years to import. Effective only with the ts, tsl or ind formats.

...

other arguments supplied to the import method, which is read.csv by default, or read.dta if file is a Stata dta dataset, or read.spss if file is a SPSS sav dataset.

Details

This version of the package handles all four QOG datasets:

QOG Standard std 15 May 2013
QOG Social Policy soc 4 April 2012
QOG Basic bas): 28 March 2011
QOG Expert Survey exp 3-6 September 2012
URL: http://www.qog.pol.gu.se

Each QOG dataset is available in a variety of data formats:

The QOG Standard series comes in CSV, SPSS and Stata file formats, CVS being the only format that contains numeric codes instead of QOG value labels. Datasets outside of the QOG Standard series are available only as Stata items and require that file ends in .dta when version is not std. The only exception is dataset csyom, which automatically sets version to std and requires file to end in .csv. Filenames with inadequate extensions will be modified to conform to these expectations if they do not.

Author(s)

Francois Briatte f.briatte@ed.ac.uk

See Also

qogbook, read.dta, read.spss

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Show URL to QOG Standard cross-section.
qogdata()
# Show URL to QOG Social Policy time series, long format.
qogdata(version = "soc", format = "tsl")
## Download codebook and recent years from QOG Basic cross-section (not run).
# QOG = qogdata(file = "qog.cs.txt", version = "bas", format = "cs",
#         years = 2002:2012, codebook = TRUE)
## Download QOG Standard cross-section years of measurement (not run).
# QOG = qogdata(tempfile(fileext = ".csv"), format = "csyom")
## Show QOG years of measurement for Gini coefficient (not run).
# table(QOG$wdi_gini)

briatte/qogdata documentation built on May 13, 2019, 7:43 a.m.