adibender/coalitions

Correctly handle duplicate wahlrecht entries

bauer-alex opened this issue · 0 comments

Wahlrecht.de currently contains a duplicate entry for the INSA poll on 05.01.2021. scrape_wahlrecht outputs both entries, which causes problems in subsequent functions.

Solution: Drop one of the duplicates in scrape_wahlrecht.

Reproducible example:

library(coalitions)
library(dplyr)

# scrape data
dat <- scrape_wahlrecht("https://www.wahlrecht.de/umfragen/insa.htm")

dat %>% filter(date == "2021-01-05")
#>         date      start        end cdu spd greens fdp left pirates fw afd
#> 1 2021-01-05 2021-01-01 2021-01-04  36  15     18 7.5  7.5      NA NA  11
#> 2 2021-01-05 2021-01-01 2021-01-04  36  15     18 7.5  7.5      NA NA  11
#>   others respondents
#> 1      5        2072
#> 2      5        2072

Created on 2021-05-12 by the reprex package (v0.3.0)