knitr::opts_chunk$set(warning = FALSE, message = FALSE)
library(ggplot2)
library(tidyverse)
library(base)
Gendergap <- read.csv("~/Desktop/RStudio/STAT_220/quizzes and portfolio projects/proj1-audreymoyer/STAT220.portfolio1.data - Sheet1 (1).csv")
library(plotly)
library(DT)
wage_gap_graph <- ggplot(data = Gendergap) +
  geom_point(aes(x = Year, y = `United.States`), color = "#b1360a") +
  geom_line(aes(x = Year, y = `United.States`), color = "#b1360a") +
  geom_point(aes(x = Year, y = `UK`), color = "#4c6a9c", shape = "square") +
  geom_line(aes(x = Year, y = `UK`), color = "#4c6a9c") +
  geom_point(aes(x = Year, y = `Japan`), color = "#2e8466", shape = "triangle") +
  geom_line(aes(x = Year, y = `Japan`), color = "#2e8466") +
  geom_point(aes(x = Year, y = `Korea`), color = "#6e3e91", shape = "diamond") +
  geom_line(aes(x = Year, y = `Korea`), color = "#6e3e91") +
  geom_point(aes(x = Year, y = `Mexico`), color = "deeppink3", shape = 6) +
  geom_line(aes(x = Year, y = `Mexico`), color = "deeppink3") +
  geom_point(aes(x = Year, y = `Colombia`), color = "orange", shape = 13) +
  geom_line(aes(x = Year, y = `Colombia`), color = "orange") +
  geom_point(aes(x = Year, y = `Sweden`), color = "#996d3a", shape = 8) +
  geom_line(aes(x = Year, y = `Sweden`), color = "#996d3a") +
  geom_point(aes(x = Year, y = `Norway`), color = "grey27", shape = "plus") +
  geom_line(aes(x = Year, y = `Norway`), color = "grey27") + 
  geom_vline(xintercept = 2009, color = "#b1360a") +
  geom_vline(xintercept = 2010, color = "#4c6a9c") + 
  geom_vline(xintercept = 1985, color = "#2e8566") +
  theme_minimal() +
  annotate("text", x = 2002, y = .5,
           label = "Lilly Ledbetter Fair 
  Pay Act of 2009, U. S.", size = 3, color = "#b1360a", fontface = c("bold"), family = c("serif")) +
  annotate("text", x = 2018, y = .50,
           label = "Equality Act of 2010, UK", color = "#4c6a9c", size = 3, fontface = c("bold"), family = c("serif")) +
  annotate("text", x = 1976.6, y = .25,
           label = "Equal Employment 
      Opportunity Act, Japan", color = "#2e8466", size = 3, fontface = c("bold"), family = c("serif")) +
  coord_cartesian(clip = "off") +
  theme(
    plot.margin = margin(0.1, 0.9, 0.1, 0.1, "in")
    ) +
  scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
  labs(title = "Unadjusted gender wage gap in median earnings, 1970 to 2023", x = "", y = "Women's pay as a percentage of men's pay", subtitle = "Scatterplot of the difference between median earnings of men and women relative to median 
earnings of men in South Korea, Japan, the U.S, Mexico, the U.K, Sweden, Norway, and Colombia, 
where each country's gap gradually declines.")
ggplotly(wage_gap_graph)
datatable(Gendergap)