as_survey | R Documentation |
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.
as_survey( percent, samplesize, parties = c("cdu", "spd", "gruene", "fdp", "linke", "piraten", "afd", "fw", "sonstige"), epsilon = 1e-05 )
percent |
Votes in percent each party received in the survey
of interest. Can be set to |
samplesize |
Number of respondents in survey. |
parties |
Vector of same length and in the same order as |
epsilon |
The parameter |
A data.frame
containing input and absolute number of votes
in survey per party.
redistribute
forsa <- as_survey( percent = c(0.41, 0.24, 0.13, 0.04, 0.08, 0.03, 0.03, 0.04), samplesize = 2508, parties = c("cdu/csu", "spd", "gruene", "fdp", "linke", "piraten", "afd", "others")) forsa
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.