as_survey: Creates basic survey table from votes in percent
Description
This functions takes votes in percent (per party) obtained from a survey,
and returns a table containing votes (in percent) and party names. Conducts
sanity checks along the way, such as checking that percentages add up to 1.
A data.frame containing input and absolute number of votes
in survey per party.
Arguments
percent
Votes in percent each party received in the survey
of interest. Can be set to NA, if parties are specified that are not
mentioned in the specific survey (otherwise the parties argument has
to be modified).
samplesize
Number of respondents in survey.
parties
Vector of same length and in the same order as percent
epsilon
The parameter percent should add up to one.
This parameter controls the maximal numerical divergence allowed.