mp_maindataset: Access the Manifesto Project's Main Dataset

Description Usage Arguments Details Value Examples

View source: R/manifesto.R

Description

Gets the Manifesto Project's Main Dataset from the project's web API or the local cache, if it was already downloaded before.

Usage

1
2
3
4
5
6
7
8
9
mp_maindataset(
  version = "current",
  south_america = FALSE,
  download_format = NULL,
  apikey = NULL,
  cache = TRUE
)

mp_southamerica_dataset(...)

Arguments

version

Specify the version of the dataset you want to access. Use "current" to obtain the most recent, or use mp_coreversions for a list of available versions.

south_america

flag whether to download corresponding South America dataset instead of Main Dataset

download_format

Download format. If not NULL, instead of the dataset being returned as an R data.frame, a file path to a temporary file in the specified binary format is returned. Can be one of c("dta", "xlsx", "sav"). With the "dta" option, labeled columns can be obtained.

apikey

API key to use. Defaults to NULL, resulting in using the API key set via mp_setapikey.

cache

Boolean flag indicating whether to use locally cached data if available.

...

all arguments of mp_southamerica_data are passed on to mp_maindataset

Details

mp_southamerica_dataset is a shorthand for getting the Manifesto Project's South America Dataset (it is equivalent to mp_maindataset(..., south_america = TRUE)).

Value

The Manifesto Project Main Dataset with classes data.frame and tbl_df

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
mpds <- mp_maindataset()
head(mpds)
median(subset(mpds, countryname == "Switzerland")$rile, na.rm = TRUE)

## End(Not run)
## Not run: 
mp_maindataset(download_format = "dta") %>% read_dta() ## requires package haven

## End(Not run)

manifestoR documentation built on Jan. 13, 2021, 9:53 a.m.