pref.data {pref}R Documentation

put election data in an R file (.rda)

Description

put election data in an R file (.rda)

Usage

pref.data(
  datafile,
  mult = FALSE,
  details = TRUE,
  parties = FALSE,
  ballot = FALSE,
  friendly = FALSE,
  header = FALSE
)

Arguments

datafile

File with election data

mult

Whether includes aggregated votes (default FALSE)

details

Whether full election detail (default) or just vote matrix

parties

File with party details (default FALSE, i.e. omit)

ballot

Default FALSE (meaning pref format)

friendly

Default FALSE (meaning most details after votes)

header

Whether a vote matrix has a header

Value

A standardised list of election info to save in a .rda file; for details see manual pref_pkg_manual.pdf (section 4)

Examples

datafile=system.file("extdata","yale.dat",package="pref")
yale=pref.data(datafile,details=FALSE)
datafile=system.file("extdata","Jedburgh2012.blt",package="pref")
parties12=system.file("extdata","parties_SC2012.txt",package="pref")
jed12=pref.data(datafile,mult=TRUE,parties=parties12)
datafile=system.file("extdata","jmt2002.blt",package="pref")
j02=pref.data(datafile,friendly=TRUE)

[Package pref version 0.4.0 Index]