Code
library(tidyverse)
library(gt)
jobs <- read_csv("https://jsuleiman.com/datasets/me_grad_employment.csv")
jobs_fixedup <- jobs|>
select(occupation, base_employment, projected_employment, growth_rate,
annual_openings, median_wage, entry_wage)|>
mutate(growth_rate = str_remove(growth_rate,"%")|> as.numeric()/100,
median_wage = parse_number(median_wage),
entry_wage = parse_number(entry_wage))
max_wage <- max(jobs_fixedup$median_wage, na.rm =TRUE)
min_wage <- min(jobs_fixedup$median_wage, na.rm =TRUE)
table <- jobs_fixedup|>
arrange(desc(median_wage))|>
gt()|>
fmt_number(columns = c(base_employment, projected_employment, annual_openings),
decimals = 0,
use_seps =TRUE)|>
fmt_percent(columns = growth_rate,
decimals =0)|>
fmt_currency(columns = c(median_wage, entry_wage),
currency ="USD", decimals =0)|>
cols_label(occupation ="Occupation",
base_employment ="2020 Employment",
projected_employment ="2030 Employment",
growth_rate ="Growth Rate",
annual_openings ="Annual Openings",
median_wage ="Median Wage",
entry_wage ="Entry Wage")|>
tab_options(column_labels.font.weight ="bold",
table.font.size = px(14),
table.width = pct(100),
table.background.color ="#E6F2FF",
heading.border.bottom.color ="#6A0DAD")|>
tab_style(style = cell_fill(color = "#CCE0FF"),locations = cells_body(columns = 'growth_rate'))|>
tab_style(style=list(cell_fill(color="#FF7F7F"), cell_text(weight="bold")),locations=cells_body(columns='growth_rate',rows=growth_rate<0))|>
tab_style(style = list(cell_text(align ="right")),
locations = cells_body(columns = c(base_employment, projected_employment,
annual_openings, median_wage, entry_wage))) |>
tab_style(style = list(cell_fill(color ="#FFD1DC")),
locations = cells_body(columns = median_wage,
rows = median_wage == max_wage | median_wage == min_wage))|>
tab_header(title ="Maine Employment Projections (2020-2030)",
subtitle ="Projected job growth, median wage, and entry wage for selected occupations in Maine")
table| Maine Employment Projections (2020-2030) | ||||||
|---|---|---|---|---|---|---|
| Projected job growth, median wage, and entry wage for selected occupations in Maine | ||||||
| Occupation | 2020 Employment | 2030 Employment | Growth Rate | Annual Openings | Median Wage | Entry Wage |
| Pharmacists | 1,366 | 1,388 | 2% | 53 | $135,430 | $102,210 |
| Physician Assistants | 795 | 971 | 22% | 61 | $131,540 | $109,100 |
| Veterinarians | 536 | 571 | 7% | 22 | $128,240 | $90,250 |
| Nurse Practitioners | 1,332 | 1,804 | 35% | 117 | $123,140 | $99,830 |
| Education Administrators, Kindergarten through Secondary | 1,673 | 1,683 | 1% | 111 | $98,800 | $74,900 |
| Lawyers | 2,725 | 2,862 | 5% | 121 | $98,760 | $66,090 |
| Physical Therapists | 1,580 | 1,667 | 6% | 71 | $90,590 | $75,330 |
| Psychologists, All Other | 893 | 920 | 3% | 60 | $85,520 | $62,970 |
| Health Specialties Teachers, Postsecondary | 706 | 797 | 13% | 67 | $84,500 | $59,510 |
| Biochemists and Biophysicists | 414 | 388 | −6% | 25 | $84,440 | $67,990 |
| Education Administrators, Postsecondary | 752 | 738 | −2% | 48 | $82,460 | $60,440 |
| English Language and Literature Teachers, Postsecondary | 428 | 411 | −4% | 30 | $81,960 | $61,310 |
| Business Teachers, Postsecondary | 309 | 313 | 1% | 24 | $81,340 | $56,730 |
| Speech-Language Pathologists | 764 | 852 | 12% | 52 | $80,210 | $60,110 |
| Occupational Therapists | 1,161 | 1,200 | 3% | 68 | $79,700 | $63,760 |
| Biological Science Teachers, Postsecondary | 303 | 311 | 3% | 25 | $79,220 | $59,190 |
| Art, Drama, and Music Teachers, Postsecondary | 587 | 575 | −2% | 45 | $78,380 | $51,380 |
| Nursing Instructors and Teachers, Postsecondary | 404 | 452 | 12% | 38 | $77,370 | $55,710 |
| Education Teachers, Postsecondary | 410 | 404 | −1% | 31 | $76,480 | $51,410 |
| Instructional Coordinators | 895 | 895 | 0% | 76 | $73,760 | $53,990 |
| Postsecondary Teachers, All Other | 378 | 371 | −2% | 28 | $72,170 | $43,980 |
| Mental Health and Substance Abuse Social Workers | 1,459 | 1,460 | 0% | 100 | $66,380 | $49,370 |
| Acupuncturists | 432 | 432 | 0% | 26 | $65,040 | $44,520 |
| Healthcare Social Workers | 484 | 495 | 2% | 42 | $64,040 | $54,770 |
| Librarians and Media Collections Specialists | 914 | 904 | −1% | 83 | $59,010 | $41,020 |
| Educational, Guidance, and Career Counselors and Advisors | 1,679 | 1,712 | 2% | 122 | $56,780 | $42,910 |