limit_days: limit days in a data set

Description Usage Arguments Details Value

Description

internal function that handles missing values in the data frame of a pollyvote object. Different error handling arguments can be handed over. If election_data, election and election_date are supplied to the function, than the election date which is supplied will be used and resolving of the election date from get_election_result(pv, election_name = election) will be ignored.

Usage

1
limit_days(data, no_days, election_data, pv, election, election_date, ...)

Arguments

data

[data.frame()]
data frame of a pollyvote object.

no_days

[integer(1)]
number of days before the election to return results for.

election_data

[data.frame()]
data frame containing the election results. The election date is included in the date coulmn.

pv

[pollyvote(1)]
pollyvote container to extract the election from.

election

[character(1)]
name of the election from pv$election_result to use.

election_date

[character(1)]
date of the election in the format '%Y-%m-%d'. If not supplied, the date of the election has to be supplied in the election data.

...

[list()]
additional arguments, currently ignored.

Details

If limit_days is called like: limit_days(pv$data, no_days = 10, election_date = "Y-M-DD") and if pv object is not supplied, then election_date will not be validated whether it is existing election date in the pollyvote object. Therefore, it is more safe for if pollyvote object is also supplied as an argument (e.g. limit_days(pv$data, no_days = 10, pv = pv, election_date = "Y-M-DD")).

Value

the data set limited to the number of days before the election.


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