Introduction

This project examines the relationship between educational attainment and income levels in the United States. The analysis uses wage data categorized by educational attainment and prepare the data for future comparisons with graduation and educational attainment datasets, to investigate whether higher levels of education are associated with higher earnings. The analysis will also consider differences across demographic groups, including gender and race, to explore whether the relationship between education and income varies across populations.

The project successfully retrieved wage data from a publicly accessible dataset and I transformed the dataset into multiple data frames to facilitate analysis. I organized the data according to key demographic and educational variables, including education level, gender, and race. This structure will support subsequent analysis and visualization while allowing for comparisons of income patterns across educational and demographic groups.

GitHub repository data Raw source:

https://raw.githubusercontent.com/lioneljr17/LDATA607/refs/heads/main/wage_by_edu.csv

library(readr)
wage_by_edu <- read_csv("https://raw.githubusercontent.com/lioneljr17/LDATA607/refs/heads/main/wage_by_edu.csv")
## Rows: 50 Columns: 61
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (61): year, less_than_hs, high_school, some_college, bachelors_degree, a...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
names(wage_by_edu)
##  [1] "year"                            "less_than_hs"                   
##  [3] "high_school"                     "some_college"                   
##  [5] "bachelors_degree"                "advanced_degree"                
##  [7] "men_less_than_hs"                "men_high_school"                
##  [9] "men_some_college"                "men_bachelors_degree"           
## [11] "men_advanced_degree"             "women_less_than_hs"             
## [13] "women_high_school"               "women_some_college"             
## [15] "women_bachelors_degree"          "women_advanced_degree"          
## [17] "white_less_than_hs"              "white_high_school"              
## [19] "white_some_college"              "white_bachelors_degree"         
## [21] "white_advanced_degree"           "black_less_than_hs"             
## [23] "black_high_school"               "black_some_college"             
## [25] "black_bachelors_degree"          "black_advanced_degree"          
## [27] "hispanic_less_than_hs"           "hispanic_high_school"           
## [29] "hispanic_some_college"           "hispanic_bachelors_degree"      
## [31] "hispanic_advanced_degree"        "white_men_less_than_hs"         
## [33] "white_men_high_school"           "white_men_some_college"         
## [35] "white_men_bachelors_degree"      "white_men_advanced_degree"      
## [37] "black_men_less_than_hs"          "black_men_high_school"          
## [39] "black_men_some_college"          "black_men_bachelors_degree"     
## [41] "black_men_advanced_degree"       "hispanic_men_less_than_hs"      
## [43] "hispanic_men_high_school"        "hispanic_men_some_college"      
## [45] "hispanic_men_bachelors_degree"   "hispanic_men_advanced_degree"   
## [47] "white_women_less_than_hs"        "white_women_high_school"        
## [49] "white_women_some_college"        "white_women_bachelors_degree"   
## [51] "white_women_advanced_degree"     "black_women_less_than_hs"       
## [53] "black_women_high_school"         "black_women_some_college"       
## [55] "black_women_bachelors_degree"    "black_women_advanced_degree"    
## [57] "hispanic_women_less_than_hs"     "hispanic_women_high_school"     
## [59] "hispanic_women_some_college"     "hispanic_women_bachelors_degree"
## [61] "hispanic_women_advanced_degree"

Data Tranformation

The first step in the analysis was to load the wage dataset from a publicly accessible website into my GitHub Repository, which was successful. After reviewing the availability variables, I selected a subset of columns related to educational attainment. The select columns were renamed to improve readability and to make the Dataset easier to interpret.

wage_by_LevelOfEdu <- wage_by_edu%>%
  select(year,less_than_hs,high_school,some_college,bachelors_degree,advanced_degree)%>%
  rename (Year =year, No_Diploma=less_than_hs,High_school_diploma=high_school, Some_college=some_college, Bachelors_Degree =bachelors_degree, Graduate_School=advanced_degree)

head (wage_by_LevelOfEdu)
## # A tibble: 6 × 6
##    Year No_Diploma High_school_diploma Some_college Bachelors_Degree
##   <dbl>      <dbl>               <dbl>        <dbl>            <dbl>
## 1  2022       16.5                21.9         24.8             41.6
## 2  2021       16.7                22.3         24.9             41.3
## 3  2020       17.0                22.7         25.4             41.6
## 4  2019       16.1                21.6         24               39.6
## 5  2018       15.9                21.5         23.7             38.9
## 6  2017       15.9                21.3         23.3             38.6
## # ℹ 1 more variable: Graduate_School <dbl>
summary(wage_by_LevelOfEdu)
##       Year        No_Diploma    High_school_diploma  Some_college  
##  Min.   :1973   Min.   :13.95   Min.   :19.62       Min.   :22.04  
##  1st Qu.:1985   1st Qu.:14.88   1st Qu.:20.39       1st Qu.:22.55  
##  Median :1998   Median :15.34   Median :20.86       Median :23.18  
##  Mean   :1998   Mean   :15.70   Mean   :20.88       Mean   :23.22  
##  3rd Qu.:2010   3rd Qu.:16.50   3rd Qu.:21.48       3rd Qu.:23.70  
##  Max.   :2022   Max.   :18.06   Max.   :22.70       Max.   :25.44  
##  Bachelors_Degree Graduate_School
##  Min.   :30.04    Min.   :35.32  
##  1st Qu.:31.88    1st Qu.:38.76  
##  Median :34.20    Median :44.09  
##  Mean   :34.77    Mean   :43.90  
##  3rd Qu.:37.12    3rd Qu.:47.56  
##  Max.   :41.65    Max.   :53.74

Additional Data Frames

To help support future analysis, another subset of columns related to educational attainment by gender and racial demographic groups. These transformed Datasets allow for more focused comparisons of wage trends across different populations while maintaining the original data structure.

wage_by_LevelOfEdu_gender <- wage_by_edu%>%
  select (year,men_less_than_hs,men_high_school,men_some_college,men_bachelors_degree,men_advanced_degree,women_less_than_hs,women_high_school,women_some_college,women_bachelors_degree,women_advanced_degree)

head (wage_by_LevelOfEdu_gender)
## # A tibble: 6 × 11
##    year men_less_than_hs men_high_school men_some_college men_bachelors_degree
##   <dbl>            <dbl>           <dbl>            <dbl>                <dbl>
## 1  2022             18.0            24.1             28.0                 49.0
## 2  2021             18.3            24.4             28.0                 47.8
## 3  2020             18.8            25.1             28.6                 48.2
## 4  2019             17.6            24.0             27.0                 45.7
## 5  2018             17.7            23.7             26.6                 45.0
## 6  2017             17.6            23.5             25.9                 44.5
## # ℹ 6 more variables: men_advanced_degree <dbl>, women_less_than_hs <dbl>,
## #   women_high_school <dbl>, women_some_college <dbl>,
## #   women_bachelors_degree <dbl>, women_advanced_degree <dbl>
summary(wage_by_LevelOfEdu_gender)
##       year      men_less_than_hs men_high_school men_some_college
##  Min.   :1973   Min.   :15.39    Min.   :22.11   Min.   :24.78   
##  1st Qu.:1985   1st Qu.:16.25    1st Qu.:22.95   1st Qu.:25.80   
##  Median :1998   Median :16.91    Median :23.70   Median :26.36   
##  Mean   :1998   Mean   :17.57    Mean   :23.83   Mean   :26.33   
##  3rd Qu.:2010   3rd Qu.:18.61    3rd Qu.:24.31   3rd Qu.:27.01   
##  Max.   :2022   Max.   :21.18    Max.   :26.90   Max.   :28.55   
##  men_bachelors_degree men_advanced_degree women_less_than_hs women_high_school
##  Min.   :35.16        Min.   :38.72       Min.   :11.75      Min.   :16.45    
##  1st Qu.:36.60        1st Qu.:43.07       1st Qu.:12.50      1st Qu.:16.89    
##  Median :39.48        Median :48.94       Median :12.81      Median :17.37    
##  Mean   :39.99        Mean   :49.43       Mean   :12.85      Mean   :17.57    
##  3rd Qu.:42.34        3rd Qu.:54.51       3rd Qu.:13.08      3rd Qu.:18.32    
##  Max.   :49.01        Max.   :63.52       Max.   :14.40      Max.   :19.36    
##  women_some_college women_bachelors_degree women_advanced_degree
##  Min.   :17.91      Min.   :22.94          Min.   :28.47        
##  1st Qu.:18.78      1st Qu.:25.46          1st Qu.:32.28        
##  Median :19.98      Median :29.43          Median :38.34        
##  Mean   :19.94      Mean   :28.93          Mean   :36.98        
##  3rd Qu.:21.07      3rd Qu.:31.98          3rd Qu.:40.88        
##  Max.   :22.35      Max.   :35.41          Max.   :46.04
wage_by_LevelOfEdu_race <- wage_by_edu%>%
  select (year,white_less_than_hs,white_high_school,white_some_college,white_bachelors_degree,white_advanced_degree,black_less_than_hs,black_high_school,black_some_college,black_bachelors_degree,black_advanced_degree,hispanic_less_than_hs,hispanic_high_school,hispanic_some_college,hispanic_bachelors_degree,hispanic_advanced_degree)

head (wage_by_LevelOfEdu_race)
## # A tibble: 6 × 16
##    year white_less_than_hs white_high_school white_some_college
##   <dbl>              <dbl>             <dbl>              <dbl>
## 1  2022               15.7              23.3               26.3
## 2  2021               16.2              23.6               26.3
## 3  2020               17.0              24                 26.9
## 4  2019               15.9              22.9               25.5
## 5  2018               16.0              23.0               25.2
## 6  2017               16.0              22.7               24.6
## # ℹ 12 more variables: white_bachelors_degree <dbl>,
## #   white_advanced_degree <dbl>, black_less_than_hs <dbl>,
## #   black_high_school <dbl>, black_some_college <dbl>,
## #   black_bachelors_degree <dbl>, black_advanced_degree <dbl>,
## #   hispanic_less_than_hs <dbl>, hispanic_high_school <dbl>,
## #   hispanic_some_college <dbl>, hispanic_bachelors_degree <dbl>,
## #   hispanic_advanced_degree <dbl>
summary(wage_by_LevelOfEdu_race)
##       year      white_less_than_hs white_high_school white_some_college
##  Min.   :1973   Min.   :14.25      Min.   :20.26     Min.   :22.60     
##  1st Qu.:1985   1st Qu.:15.18      1st Qu.:21.02     1st Qu.:23.09     
##  Median :1998   Median :15.54      Median :21.84     Median :23.70     
##  Mean   :1998   Mean   :16.00      Mean   :21.69     Mean   :23.97     
##  3rd Qu.:2010   3rd Qu.:16.68      3rd Qu.:22.16     3rd Qu.:24.61     
##  Max.   :2022   Max.   :18.67      Max.   :24.00     Max.   :26.90     
##  white_bachelors_degree white_advanced_degree black_less_than_hs
##  Min.   :30.44          Min.   :35.42         Min.   :13.12     
##  1st Qu.:32.50          1st Qu.:39.12         1st Qu.:13.92     
##  Median :35.07          Median :44.94         Median :14.28     
##  Mean   :35.65          Mean   :44.35         Mean   :14.48     
##  3rd Qu.:38.28          3rd Qu.:48.26         3rd Qu.:15.14     
##  Max.   :43.30          Max.   :53.80         Max.   :16.40     
##  black_high_school black_some_college black_bachelors_degree
##  Min.   :16.90     Min.   :19.12      Min.   :25.59         
##  1st Qu.:17.70     1st Qu.:19.99      1st Qu.:27.55         
##  Median :18.18     Median :20.54      Median :29.64         
##  Mean   :18.23     Mean   :20.50      Mean   :29.57         
##  3rd Qu.:18.69     3rd Qu.:20.99      3rd Qu.:31.52         
##  Max.   :19.79     Max.   :21.93      Max.   :33.64         
##  black_advanced_degree hispanic_less_than_hs hispanic_high_school
##  Min.   :32.40         Min.   :13.22         Min.   :17.41       
##  1st Qu.:35.91         1st Qu.:14.79         1st Qu.:18.50       
##  Median :38.55         Median :15.22         Median :19.08       
##  Mean   :38.30         Mean   :15.35         Mean   :19.08       
##  3rd Qu.:40.66         3rd Qu.:16.26         3rd Qu.:19.48       
##  Max.   :45.76         Max.   :17.61         Max.   :21.46       
##  hispanic_some_college hispanic_bachelors_degree hispanic_advanced_degree
##  Min.   :20.05         Min.   :25.15             Min.   :25.67           
##  1st Qu.:20.90         1st Qu.:28.41             1st Qu.:36.19           
##  Median :21.25         Median :30.38             Median :41.37           
##  Mean   :21.36         Mean   :30.40             Mean   :39.89           
##  3rd Qu.:21.84         3rd Qu.:32.37             3rd Qu.:43.89           
##  Max.   :23.34         Max.   :36.13             Max.   :48.60
#plot(wage_by_edu)
ggplot()+ geom_line(data = wage_by_edu, aes(x = year, y = less_than_hs,color ="Less Than High School")) + 
  geom_line(data= wage_by_edu,aes(x = year, y = high_school, color="High School"))+
  geom_line(data= wage_by_edu,aes(x = year, y = some_college, color="Some College"))+
  geom_line(data= wage_by_edu, aes(x = year, y =bachelors_degree, color ="Bachelor's Degree")) +
  geom_line(data= wage_by_edu,aes(x = year, y =advanced_degree,color ="Advanced Degree"))+ 
  labs(title ="Average Wages By Education level",x ="Year",y="Average wages(USD)", color ="Education Level")+
   scale_color_manual(values = c(
     "Less Than High School" = 'black',
      "High School" = 'red',
      "Some College" = 'blue',
      "Bachelor's Degree" = 'green',
      "Advanced Degree"='orange'
    )
  ) +theme_minimal()

Conclusion

I was successfully able to retrieve the wage dataset from a publicly accessible GitHub repository and transform it into several structured data frames organized by education level, gender, and race. Relevant variables were selected, renamed, and reformatted to create a cleaner and more interpretable dataset for analysis. The visualization of average wages by educational attainment shows a positive association between education and earnings, with individuals holding bachelor’s and advanced degrees generally reporting higher average wages than those with lower levels of education. While these findings provide preliminary evidence of a relationship between educational attainment and income, the current analysis does not establish a causal relationship. Future analysis could integrate graduation and educational attainment statistics with wage data to further examine how educational achievement is associated with income across gender and racial groups and how these patterns have changed over time.