https://github.com/bauer-alex/coalitions
Poll based calculation of coalition probabilities
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 6 DOI reference(s) in README -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.9%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
Poll based calculation of coalition probabilities
Basic Info
- Host: GitHub
- Owner: bauer-alex
- License: other
- Language: R
- Default Branch: master
- Homepage: https://adibender.github.io/coalitions/
- Size: 6.24 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Fork of adibender/coalitions
Created over 8 years ago
· Last pushed over 7 years ago
https://github.com/bauer-alex/coalitions/blob/master/
# coalitions[](https://www.tidyverse.org/lifecycle/#stable) [](https://travis-ci.org/adibender/coalitions) [](https://ci.appveyor.com/project/adibender/coalitions) [](https://codecov.io/github/adibender/coalitions?branch=master) [](https://doi.org/10.21105/joss.00606) [](https://doi.org/10.5281/zenodo.1172594) [](https://cran.r-project.org/package=coalitions) [](https://cran.r-project.org/package=coalitions) [](https://opensource.org/licenses/MIT) ## Overview The package offers functions that calculate coalition probabilities in multi-party elections, based on a survey results: - To get started, see our [workflow vignette](https://adibender.github.io/coalitions/articles/workflow.html) - See our [talk](https://adibender.netlify.com/talk/appliedr-meetup/) at the [Munich AppliedR MeetUp](https://www.meetup.com/de-DE/Applied-R-Munich/) - Check out our [interacitve shiny app](http://koala.stat.uni-muenchen.de/) on German (state and federal) elections/surveys - Updates are available on our [KOALA\_LMU twitter account](https://twitter.com/KOALA_LMU)\! ## Installation ```r # To install from CRAN use: install.packages("coalitions") # To install the most current version from GitHub use: devtools::install_github("adibender/coalitions") ``` ## Usage Detailed workflow is outlined in the [workflow](https://adibender.github.io/coalitions/articles/workflow.html) vignette. A short overview is presented below. ### Scrape surveys The wrapper `get_surveys()` which takes no arguments, downloads all surveys currently available at [wahlrecht.de](https://www.wahlrecht.de/umfragen) and stores them in a nested `tibble`: ``` r library(coalitions) library(dplyr) library(tidyr) surveys <- get_surveys() surveys ``` ## # A tibble: 7 x 2 ## pollster surveys ##
## 1 allensbach
## 2 emnid ## 3 forsa ## 4 fgw ## 5 gms ## 6 infratest ## 7 insa Each row represents a polling agency and each row in the `surveys` column again contains a nested `tibble` with survey results from different time-points: ``` r surveys %>% filter(pollster == "allensbach") %>% unnest() ``` ## # A tibble: 42 x 6 ## pollster date start end respondents survey ## ## 1 allensbach 2018-02-23 2018-02-02 2018-02-15 1271
% unnest() %>% slice(1) survey %>% unnest() ``` ## # A tibble: 7 x 8 ## pollster date start end respondents party percent ## ## 1 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 cdu 32.0 ## 2 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 spd 17.5 ## 3 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 greens 12.0 ## 4 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 fdp 11.0 ## 5 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 left 9.50 ## 6 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 afd 13.0 ## 7 allensbach 2018-02-23 2018-02-02 2018-02-15 1271 others 5.00 ## # ... with 1 more variable: votes ### Calculate coalition probabilities For each survey (row) we can calculate the coalition probabilities ``` r survey %>% get_probabilities(nsim=1e4) %>% unnest() ``` ## # A tibble: 6 x 4 ## pollster date coalition probability ## ## 1 allensbach 2018-02-23 cdu 0 ## 2 allensbach 2018-02-23 cdu_fdp 0.0500 ## 3 allensbach 2018-02-23 cdu_fdp_greens 100.0 ## 4 allensbach 2018-02-23 spd 0 ## 5 allensbach 2018-02-23 left_spd 0 ## 6 allensbach 2018-02-23 greens_left_spd 0
Owner
- Name: Alexander Bauer
- Login: bauer-alex
- Kind: user
- Repositories: 11
- Profile: https://github.com/bauer-alex
[](https://www.tidyverse.org/lifecycle/#stable)
[](https://travis-ci.org/adibender/coalitions)
[](https://ci.appveyor.com/project/adibender/coalitions)
[](https://codecov.io/github/adibender/coalitions?branch=master)
[](https://doi.org/10.21105/joss.00606)
[](https://doi.org/10.5281/zenodo.1172594)
[](https://cran.r-project.org/package=coalitions)
[](https://cran.r-project.org/package=coalitions)
[](https://opensource.org/licenses/MIT)
## Overview
The package offers functions that calculate coalition probabilities in
multi-party elections, based on a survey results:
- To get started, see our [workflow
vignette](https://adibender.github.io/coalitions/articles/workflow.html)
- See our [talk](https://adibender.netlify.com/talk/appliedr-meetup/)
at the [Munich AppliedR
MeetUp](https://www.meetup.com/de-DE/Applied-R-Munich/)
- Check out our [interacitve shiny
app](http://koala.stat.uni-muenchen.de/) on German (state and
federal) elections/surveys
- Updates are available on our [KOALA\_LMU twitter
account](https://twitter.com/KOALA_LMU)\!
## Installation
```r
# To install from CRAN use:
install.packages("coalitions")
# To install the most current version from GitHub use:
devtools::install_github("adibender/coalitions")
```
## Usage
Detailed workflow is outlined in the
[workflow](https://adibender.github.io/coalitions/articles/workflow.html)
vignette.
A short overview is presented below.
### Scrape surveys
The wrapper `get_surveys()` which takes no arguments, downloads all
surveys currently available at
[wahlrecht.de](https://www.wahlrecht.de/umfragen) and stores them in a
nested `tibble`:
``` r
library(coalitions)
library(dplyr)
library(tidyr)
surveys <- get_surveys()
surveys
```
## # A tibble: 7 x 2
## pollster surveys
##