Part 1

library(tidyverse) library(knitr) load(“~/ECON_216/Census1920FB.RData”)

##Part 2 code state_income <- census_1920 %>% filter(LABFORCE == “Yes, in the labor force”, CLASSWKR == “Works for wages”) %>% select(STATEFIP, SEX, OCCSCORE)

nrow(state_income)

##Part 2 Answer The dataset state_income has 292899 rows.
The unit of observation is an individual who is in the labor force and works for wages in the year 1920

#Part 3 code state_income_summary <- state_income %>% group_by(STATEFIP,SEX) %>% summarise(average_OCCSCORE = mean(OCCSCORE, na.rm = TRUE))

#Part 4 state_income_summary %>% filter(SEX == “Male”)%>% arrange(desc(average_OCCSCORE))%>% kable(caption = “Average Income for Men Working for Wages in 1920 by State”)

state_income_summary %>% filter(SEX == “Female”)%>% arrange(desc(average_OCCSCORE))%>% kable(caption = “Average Income for Women Working for Wages in 1920 by State”)

#Part 4 Answer

According to the data, the occupational score for men overall were higher than the occupational score for women. This seems accurate as men would usually have higher level occupations and more of them woud be in the workforce than women. Most of the top states with the highest average occupational score were in the northeast for men, with the top 3 being New Jersey, Masssachusetts, and New York. This was similar for women as well as the top 3 were Conneticut, Massachusetts, and Rhode Island.

#Part 5 state_income_summary %>% pivot_wider(names_from = SEX, values_from = average_OCCSCORE) %>% mutate(GAP = Male - Female) %>% arrange(desc(GAP)) %>% kable(caption = “Income Gap between Men and Women in 1920 by State”)

#Part 5 Answer

The top 6 states with the largest gap are Alabama, Mississippi, South Carolina, Florida, and Gerogia. These are all states in the south east and during the 1920’s it was very agricultural dominated, which probably didn’t pay too much for women. The six lowest income gap were South Dakota, New Mexico, Idaho, Nebraska, Montana, and North Dakota. These are all states that were newer properties owned by America in the west where there might’ve been a lot less regulation and where women demanded close to the same as men occupation wise.