library(dplyr)
test_that("Höchste Wahlkreisnummer = 299",
{expect_equal(max(btwkandidierende2021$wahlkreis, na.rm = TRUE), "299")})
test_that("Number of candidates is 6211",
{expect_equal(nrow(btwkandidierende2021), 6211)})
test_that("If liste is missing, listenplatz must be missing, too",
{expect_equal(filter(btwkandidierende2021, is.na(liste)) %>%
count(listenplatz) %>%
pull(listenplatz),
NA_real_)})
test_that("If listenplatz is missing, liste must be missing, too",
{expect_equal(filter(btwkandidierende2021, is.na(listenplatz)) %>%
count(liste) %>%
pull(liste),
NA_character_)})
test_that("If wahlkreis is missing, listenplatz must NOT be missing",
{expect_equal(filter(btwkandidierende2021, is.na(wahlkreis)) %>%
count(listenplatz) %>%
filter(is.na(listenplatz)) %>% nrow(),
0)})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.