Skip to content

The "kosovoelections" πŸ‡½πŸ‡° R package provides data related to elections in Kosovo. The package allows users to easily access the necessary data to study the electoral process in Kosovo. The data also allows users to look at trends and changes in the electoral landscape in Kosovo πŸ‡½πŸ‡°.

License

Notifications You must be signed in to change notification settings

KushtrimVisoka/kosovoelections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

kosovoelections

License: MIT

An unofficial package with election results

Installation

# install.packages("devtools")
devtools::install_github("Kushtrimvisoka/kosovoelections")

Example

Load {kosovoelections} package…

library(kosovoelections)

Download Election Results

data <- get_election_results(type = "national", # "local" (for local assembly), or "mayor", or "mayor2" (for runoffs).
                             year = 2021,
                             by = "candidate", # or "party".
                             level = "national" # "municipality", or "pc" (Polling Center), or "ps" (Polling Station).
                             )
## Downloading data for 2021 national assembly elections, by candidate, at national level...
summary(data)
##   Candidate            Gender            Party_ID            Party          
##  Length:1052        Length:1052        Length:1052        Length:1052       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##    Acronym              Votes         
##  Length:1052        Min.   :     2.0  
##  Class :character   1st Qu.:   127.8  
##  Mode  :character   Median :   528.0  
##                     Mean   :  3515.8  
##                     3rd Qu.:  3293.5  
##                     Max.   :300756.0

Plot a simple map

# install.packages("devtools")
# devtools::install_github("Kushtrimvisoka/kosovomaps")
library(kosovoelections)
library(kosovomaps)
library(tidyverse)
library(sf)

map <- mapof(x = "municip")

data <- get_election_results(type = "national", # "local" (for local assembly), or "mayor", or "mayor2" (for runoffs).
                             year = 2021,
                             by = "candidate", # or "party".
                             level = "municipality" # "national", or "pc" (Polling Center), or "ps" (Polling Station).
                             )

data <- data %>% 
  filter(Candidate == "VJOSA OSMANI-SADRIU") %>% 
  group_by(id, Municipality, Candidate) %>% 
  summarise(Votes = sum(Votes))

data <- merge(map, data)

p <- ggplot(data = data)+
  geom_sf(aes(fill = Votes)) +
  scale_fill_viridis_c("Votes", direction = -1, option = "E") +
  labs(title = "Votes cast for Vjosa Osmani-Sadriu", 
       caption = "Source: CEC")+
  theme_void()

Plot example

print(p)

Data

Source: Central Election Commission of Kosovo (https://www.kqz-ks.org).

The data in this package are taken from the CEC website and processed in R using various packages for processing Excel and PDF files.

Disclaimer: This package does not have any connection with the CEC or other public institutions in Kosovo. I do not claim or guarantee the accuracy of the data in this package. I disclaim any responsibility or liability for errors and omissions.

For the official and certified election results, please refer to the CEC website.

Data availability

By level: national

Type of elections 2010 2013 2014 2017 2019 2021
National Assembly No Yes Yes Yes Yes Yes
Local Assembly – Yes – Yes – Yes
Mayor - First Round – Yes – Yes – Yes
Mayor - Second Round – Yes – Yes – Yes

By level: municipality

Type of elections 2010 2013 2014 2017 2019 2021
National Assembly No Yes Yes Yes Yes Yes
Local Assembly – Yes – Yes – Yes
Mayor - First Round – Yes – Yes – Yes
Mayor - Second Round – Yes – Yes – Yes

By level: polling center

Type of elections 2010 2013 2014 2017 2019 2021
National Assembly No Yes Yes Yes Yes Yes
Local Assembly – Yes – Yes – Yes
Mayor - First Round – Yes – Yes – Yes
Mayor - Second Round – Yes – Yes – Yes

By level: polling station

Type of elections 2010 2013 2014 2017 2019 2021
National Assembly No Yes Yes Yes Yes Yes
Local Assembly – Yes – Yes – Yes
Mayor - First Round – Yes – Yes – Yes
Mayor - Second Round – Yes – Yes – Yes

Codebook

Variable Name Description
id Unique ID for each Municipality.
Municipality Name of Municipality (in Albanian).
Polling Center Unique ID for each Polling Center.
Polling Station Unique ID for each Polling Station.
Candidate Name of candidate.
Gender Gender of the candidate.
Party_ID Unique ID for each political party.
Party Full name of political party.
Acronym Acronym of political party.
Votes Number of votes.

License

This package is released under the MIT License. For more, see β€œLicense”.

About

The "kosovoelections" πŸ‡½πŸ‡° R package provides data related to elections in Kosovo. The package allows users to easily access the necessary data to study the electoral process in Kosovo. The data also allows users to look at trends and changes in the electoral landscape in Kosovo πŸ‡½πŸ‡°.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages