iran | R Documentation |
A data frame containing information about the 2009 Presidential Election in Iran. There were widespread claims of election fraud in this election both internationally and within Iran.
iran
A data frame with 366 observations on the following 9 variables.
Iranian province where votes were cast.
City within province where votes were cast.
Number of votes received by Ahmadinejad.
Number of votes received by Rezai.
Number of votes received by Karrubi.
Number of votes received by Mousavi.
Total number of votes cast.
Number of votes that were not counted.
Number of votes that were counted.
library(dplyr)
library(ggplot2)
library(tidyr)
library(stringr)
plot_data <- iran |>
summarize(
ahmadinejad = sum(ahmadinejad) / 1000,
rezai = sum(rezai) / 1000,
karrubi = sum(karrubi) / 1000,
mousavi = sum(mousavi) / 1000
) |>
pivot_longer(
cols = c(ahmadinejad, rezai, karrubi, mousavi),
names_to = "candidate",
values_to = "votes"
) |>
mutate(candidate = str_to_title(candidate))
ggplot(plot_data, aes(votes, candidate)) +
geom_col() +
theme_minimal() +
labs(
title = "2009 Iranian Presidential Election",
x = "Number of votes (in thousands)",
y = ""
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.