Code
library(tidyverse)
library(gt)
library(gtExtras)
jobs <- read_csv("https://jsuleiman.com/datasets/me_grad_employment.csv")library(tidyverse)
library(gt)
library(gtExtras)
jobs <- read_csv("https://jsuleiman.com/datasets/me_grad_employment.csv")jobs <- read_csv("https://jsuleiman.com/datasets/me_grad_employment.csv")Rows: 26 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): occupation, growth_rate, median_wage, entry_wage
dbl (4): base_employment, projected_employment, annual_openings, wage_year
ℹ 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.
jobs <- jobs |>
mutate(
growth_rate = round((projected_employment - base_employment) / base_employment * 100, 1)
) |>
select(
occupation,
base_employment,
projected_employment,
growth_rate,
annual_openings,
median_wage,
entry_wage
) jobs |>
gt() |>
tab_header(
title = md("**Maine Job Outlook by Occupation (2020–2030)**"),
subtitle = "Base vs. Projected Jobs, Growth, Openings, and Wages"
) |>
tab_style(
style = cell_text(weight = "bold"),
locations = cells_column_labels(everything())
) |>
opt_table_lines(extent = "none") |>
opt_row_striping() |>
cols_align(align = "right", columns = where(is.numeric)) |>
cols_align(align = "left", columns = c(occupation)) |>
fmt_number(columns = c(base_employment, projected_employment, annual_openings),
decimals = 0, sep_mark = ",") |>
fmt_percent(columns = growth_rate, scale_values = FALSE, decimals = 1) |>
fmt_currency(columns = c(median_wage, entry_wage), currency = "USD", decimals = 0) |>
data_color(
columns = growth_rate,
fn = scales::col_numeric(
palette = c("white", "lightblue", "blue"),
domain = NULL
)
)|>
cols_label(
occupation = "Occupation",
base_employment = "Base Employment (2020)",
projected_employment = "Projected Employment (2030)",
growth_rate = "Growth Rate",
annual_openings = "Annual Openings",
median_wage = "Median Wage",
entry_wage = "Entry Wage"
) |>
opt_table_font(font = google_font("Lato")) |>
tab_options(
table.width = pct(100),
data_row.padding = px(4),
heading.title.font.size = 16,
heading.subtitle.font.size = 12
)| Maine Job Outlook by Occupation (2020–2030) | ||||||
|---|---|---|---|---|---|---|
| Base vs. Projected Jobs, Growth, Openings, and Wages | ||||||
| Occupation | Base Employment (2020) | Projected Employment (2030) | Growth Rate | Annual Openings | Median Wage | Entry Wage |
| Lawyers | 2,725 | 2,862 | 5.0% | 121 | $98760 | $66090 |
| Educational, Guidance, and Career Counselors and Advisors | 1,679 | 1,712 | 2.0% | 122 | $56780 | $42910 |
| Education Administrators, Kindergarten through Secondary | 1,673 | 1,683 | 0.6% | 111 | $98800 | $74900 |
| Physical Therapists | 1,580 | 1,667 | 5.5% | 71 | $90590 | $75330 |
| Mental Health and Substance Abuse Social Workers | 1,459 | 1,460 | 0.1% | 100 | $66380 | $49370 |
| Pharmacists | 1,366 | 1,388 | 1.6% | 53 | $135430 | $102210 |
| Nurse Practitioners | 1,332 | 1,804 | 35.4% | 117 | $123140 | $99830 |
| Occupational Therapists | 1,161 | 1,200 | 3.4% | 68 | $79700 | $63760 |
| Librarians and Media Collections Specialists | 914 | 904 | −1.1% | 83 | $59010 | $41020 |
| Instructional Coordinators | 895 | 895 | 0.0% | 76 | $73760 | $53990 |
| Psychologists, All Other | 893 | 920 | 3.0% | 60 | $85520 | $62970 |
| Physician Assistants | 795 | 971 | 22.1% | 61 | $131540 | $109100 |
| Speech-Language Pathologists | 764 | 852 | 11.5% | 52 | $80210 | $60110 |
| Education Administrators, Postsecondary | 752 | 738 | −1.9% | 48 | $82460 | $60440 |
| Health Specialties Teachers, Postsecondary | 706 | 797 | 12.9% | 67 | $84500 | $59510 |
| Art, Drama, and Music Teachers, Postsecondary | 587 | 575 | −2.0% | 45 | $78380 | $51380 |
| Veterinarians | 536 | 571 | 6.5% | 22 | $128240 | $90250 |
| Healthcare Social Workers | 484 | 495 | 2.3% | 42 | $64040 | $54770 |
| Acupuncturists | 432 | 432 | 0.0% | 26 | $65040 | $44520 |
| English Language and Literature Teachers, Postsecondary | 428 | 411 | −4.0% | 30 | $81960 | $61310 |
| Biochemists and Biophysicists | 414 | 388 | −6.3% | 25 | $84440 | $67990 |
| Education Teachers, Postsecondary | 410 | 404 | −1.5% | 31 | $76480 | $51410 |
| Nursing Instructors and Teachers, Postsecondary | 404 | 452 | 11.9% | 38 | $77370 | $55710 |
| Postsecondary Teachers, All Other | 378 | 371 | −1.9% | 28 | $72170 | $43980 |
| Business Teachers, Postsecondary | 309 | 313 | 1.3% | 24 | $81340 | $56730 |
| Biological Science Teachers, Postsecondary | 303 | 311 | 2.6% | 25 | $79220 | $59190 |
I used cell_text(weight = “bold”) together with tab_style() to make the column headings stand out from the rest of the table. In order to distinguish them from the numbers below, this made the headers bold. It makes the table seem more ordered, and the reader is aware of the precise boundaries between the data and the labels. I used opt_table_lines(extent = “none”) to eliminate the thick lines that were generated between cells in order to simplify the table and make it less cluttered. I used opt_row_striping() to add decorated rows in place of borders, which helps direct the reader’s attention across the table without making it seem cluttered. I used cols_align() to right-align all of the numeric columns, including employment, growth, and earnings, since it makes comparing figures simpler. When you want to rapidly identify the greatest or lowest numbers in a column, this is helpful. I also used cols_align() to align the text on the job titles to the left. This is the most natural method to read words in English, and it facilitates the process of looking through job titles. Additionally, the numbers’ alignment to the right creates an attractive balance. Additionally, I improved the way the numbers are shown. Since large values, such as job counts and vacant positions, don’t need decimal places, I rounded them and added commas using fmt_number(). I displayed salaries as entire dollar amounts using fmt_currency() and growth rates as one decimal place using fmt_percent(). This keeps the table tidy and prevents unnecessary information from being shown. I used data_color() to add a color scale to the growth_rate column in order to draw attention to the most significant numbers. The blue becomes darker as the growth rate increases. This eliminates the need for more explanation and makes it very simple to identify the occupations with the greatest rates of growth.
https://chatgpt.com/share/67eef19d-3874-800f-956c-68c384b5f163