Using R Shiny App to visualize gender pay gap in the United States

Wendy Yu
Posted on Mar 6, 2016

Contributed by Wendy Yu. She is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between January 11th to April 1st, 2016. This post is based on her second project - R Shiny.(due on 2nd week)


Gender Pay Gap in the United States


Saleforce closing gender pay gap (nov. 2015):


  • Salesforce shows that 70 percent of their staff is male.
  • At leadership position, 85 percent are male.
  • salesforce reviewed 17,000 employee payroll.
  • They spent 3 million extra to fix gender pay gap, and set the goal to have women make up at least 30 percent of the attendees at any meeting.

From the White House:


  • Full-time women workers’ earnings are only about 78 percent of their male counterparts’ earnings
  • Pay discrimination is a real and persistent problem that continues to shortchange American women and their families

Actions in the U.S.:


  • The Equal Pay Act of 1963 signed by John F. Kennedy, aimed at abolishing wage disparity based on sex.
  • In April of 2014, President Obama signed an Executive Order to prevent workplace discrimination by requiring federal contractors to submit data on employee compensation by race and gender.
  • January 29, 2015: Equal Employment Opportunity Commission will require companies with more than 100 employees to report salary data by gender, race, and ethnicity. First report due in September 2017.

Data exploration

Use the App below to explore changes of income and gender pay gap over the past 30 years, and see how different factors influence the pay gap.

How to use the App:

  1. Select a factor you would like to explore, and click “Update View”.
  2. Move mouse over to the bubbles to identify each group.
  3. Click play button to view changes over time.
  4. View bar chart/line chart by selecting tabs at upper right corner
  5. Switch y-axis to “Difference_Income_Norm” to see different effects

All data are collected from United States Census Bureau.

Click on the image below to go to the published Shiny App. 

Screen Shot 2016-03-06 at 2.51.49 PM

  • Average_Income: average yearly income, male and female combine, adjusted by population
  • Population: total number of working force (in thousands)
  • Difference_Income: median male income - median female income
  • Difference_Population: number of working male - number of working female
  • Difference_Income_Norm: difference_income normalize by average_income


From exploring the data above, here are some of my observations:

  • Over the years, the absolute differences in average income between men and women have increased. However, percent differences in average income between men and women have decreased. (To see these effects, select “Difference_Income” and “Difference_Income_Norm” at y-axis.)
  • In 1970s, men made about 80% to 100% more than women. In 2014, men made about 20% more than women.
  • Gender pay gap has reduced for the past few decades, but remain largely unchanged for the past 5 years.
  • Education factor: pay gap for people with a master or doctoral degree is the lowest and remain unchanged for the past decades. There is a trend for reduction in pay gap for other education levels.
  • Race: We see a general decreasing trend for all races. In 2014, pay gap is the largest for white and lowest for black. Men were paid about 52% and 28% more than women respectively.
  • Region: no difference in pay gap among different regions is observed.
  • Marital Status: pay gap is considerably larger for married ones than divorced or single. This could be explained by the traditional gender roles. In a marriage, husband is expected to be the financial provider while wife is expected to stay at home and provide domestic needs. Therefore, it makes sense to see a large gender pay gap for married couples.
  • Work time: there is a reduction in pay gap for full time employees. Interestingly, for part time employees, female were paid about 0-20% more than male between 1980 to 2010. In 2014, gender pay gap is almost gone for part time employees. This phenomenon can also be due to stereotypical gender roles. Part time jobs offer more flexibility in schedule so women can balance work and family more easily. On the other hand, very few full time jobs offer the flexibility that women require to take care of her family, for example, to pick up kids or to go to doctor’s appointments. Women are penalized for taking time off and therefore hindering their career development.
  • Job type: gender pay gap remains largely unchanged for all job types except for sales and armed forces. We see a decrease in pay gap for both sales and armed forces. Gender pay gap reached zero in 2000 for armed forces.

Overall, the good news is that gender pay gap has shrunk for the past few decades. However, the decrease in the pay gap has stopped for at least 5 years. To date, women are still making about 20% less then men. Gender pay gap is a continuous problem in the United States, we should first seek an understanding of stereotypical gender roles, we will then be at a better position to fix gender pay gap.

About Author

Wendy Yu

Wendy Yu

As a biologist, Wendy believes in evidence-base analysis, and is passionate about data. Wendy graduated from the University of Pennsylvania in 2013 with a Masters in Biotechnology. While pursuing a career as a biologist Wendy quickly realized that...
View all posts by Wendy Yu >

Related Articles

Leave a Comment

Gender Pay Gap in the United States — Dr. Jonathan Jenkins, DBA, CSSBB, MSQA April 14, 2016
[…] Science Academy 12 weeks boot camp program between Jan 11th to Apr 1st, 2016. The post was based on her second class project(due at 4th week of the program). The scandal of Sony Picture Entertainment Hack raised the […]

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp