Per default, pools surveys starting from current date and going 14 days back. For each pollster within the defined time-frame, only the most recent survey is used.
A tibble containing survey results for multiple
pollsters as returned by get_surveys.
Only surveys in the time-window from last_date to
last_date - period will be considered for each pollster. Defaults
to current date.
Character vector of pollsters that should be considered for pooling.
See last_date argument.
Optional. If specified, all surveys in the time-window
from last_date - period_extended to last_date - period will
also be considered for each pollster, but only after down-weighting them by
halving their true sample size.
Assumed correlation between surveys (of different pollsters). Defaults to 0.5.
Additional weights for individual surveys.
A data frame with one row per party containing columns
pollster (set to "pooled"), date, start,
end, respondents (effective sample size), party,
percent, and votes.
library(coalitions)
library(dplyr)
latest <- get_latest(surveys_sample)
pool_surveys(surveys_sample, last_date=as.Date("2017-09-02"))
#> # A tibble: 7 × 8
#> pollster date start end respondents party percent votes
#> <chr> <date> <date> <date> <dbl> <chr> <dbl> <dbl>
#> 1 pooled 2017-09-02 2017-08-30 2017-09-02 2931. afd 9.16 269.
#> 2 pooled 2017-09-02 2017-08-30 2017-09-02 2931. cdu 37.8 1107.
#> 3 pooled 2017-09-02 2017-08-30 2017-09-02 2931. fdp 8 234.
#> 4 pooled 2017-09-02 2017-08-30 2017-09-02 2931. greens 7.57 222.
#> 5 pooled 2017-09-02 2017-08-30 2017-09-02 2931. left 9 264.
#> 6 pooled 2017-09-02 2017-08-30 2017-09-02 2931. others 4.76 139.
#> 7 pooled 2017-09-02 2017-08-30 2017-09-02 2931. spd 23.8 696.