8 Februar 2018

The Closing of the Gender Wage Gap

This is the R code that produces the interactive line chart:

library(dplyr)
library(plotly)
library(crosstalk)

gap <- read.csv("data/OECD_gender_wage_gap.csv", sep=",")

data <- gap %>% group_by(ï..LOCATION) %>% filter(SUBJECT=="TOT" & ï..LOCATION!="EU28")

s.data <- SharedData$new(data, key=~ï..LOCATION)
  
p <- plot_ly(s.data) %>%
  add_lines(x=~TIME, y=~Value, text = ~paste(ï..LOCATION, "<br />", TIME, "<br />", Value), hoverinfo = "text")%>%
  layout(
    yaxis = list(title = "Difference in % of Male Median Wage"),
    xaxis = list(title = "Year"))

highlight(p, on="plotly_click", color="red", persistent=TRUE)