create_pollyvote: create a pollyvote data container

Description Usage Arguments Value Initial Functions Examples

Description

A pollyvote container is a list containing all the information that is needed to predict an election. This is the central construct of this package around which all other functions are centered. A pollyvote container stores all relevant data and aggregation functions. New data can be added using add_data, election results can be added using add_election_result. A pollyvote container can be predicted (predict.pollyvote) and its prediction error can be calculated (error_calc.pollyvote). An overview over the out-of-the-box predictions and error calculation functions is given in the section Initial Functions. These initial functions are not meant to be used directly, but only through predict(pv, method = "initial_prediction_..."). New prediction methods and error calculcation methods can be added to a pollyvote object using add_prediction.pollyvote and add_error_calc.pollyvote. The predictions and error calculations can also be plotted using plot.pollyvote.

Usage

1
2
3
4
5
create_pollyvote(id = "pollyvote", perm_countries = character(0),
  perm_sources = character(0), perm_source_types = character(0),
  perm_elections = character(0), perm_date_earliest = NULL,
  perm_date_latest = NULL, perm_regions = character(0),
  perm_region_types = character(0), perm_parties = character(0))

Arguments

id

[character(1)]
the name ID of the pollyvote object, defaults to 'pollyvote'.

perm_countries, perm_sources, perm_source_types, perm_elections, perm_regions, perm_region_types, perm_parties

[character(n)]
permitted values for the respective column of the data of this pollyvote object

perm_date_earliest, perm_date_latest

[POSIXct(1)]
earliest and latest permissible date in format %Y-%m-%d.

Value

object of class pollyvote, containing an id, an initially empty data frame and potentially permissible values for the entries of the data frame.

Initial Functions

some useful prediction, aggregation and error calculation functions are already initialized when calling create_pollyvote(). These are:

Examples

1
2
pv = create_pollyvote(perm_countries = "D")
pv

pollyvote/pollyvoter documentation built on May 25, 2019, 11:23 a.m.