-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xml
2068 lines (1895 loc) · 123 KB
/
index.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving
and Interchange DTD v1.2 20190208//EN" "JATS-archivearticle1.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="1.2" article-type="other">
<front>
<journal-meta>
<journal-id></journal-id>
<journal-title-group>
<journal-title>Beeck Center for Social Impact and
Innovation</journal-title>
</journal-title-group>
<issn></issn>
<publisher>
<publisher-name></publisher-name>
</publisher>
</journal-meta>
<article-meta>
<title-group>
<article-title>Climate resilience requires equitable access to quality
green energy jobs. The City of Saint Paul is at the
forefront.</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name>
<surname>Ali</surname>
<given-names>Elham</given-names>
</name>
<string-name>Elham Ali</string-name>
<email>[email protected]</email>
<role>Researcher</role>
<role>Data Storytelling</role>
<role>Human-centered Design</role>
<role>Data Visualization</role>
<xref ref-type="aff" rid="aff-1">a</xref>
<xref ref-type="corresp" rid="cor-1">*</xref>
</contrib>
</contrib-group>
<aff id="aff-1">
<institution-wrap>
<institution>Beeck Center for Social Impact and Innovation at Georgetown
University</institution>
</institution-wrap>
</aff>
<author-notes>
<corresp id="cor-1">[email protected]</corresp>
</author-notes>
<pub-date date-type="pub" publication-format="electronic" iso-8601-date="2024-09-19">
<year>2024</year>
<month>9</month>
<day>19</day>
</pub-date>
<history></history>
<permissions>
<license license-type="creative-commons">
<ali:license_ref xmlns:ali="http://www.niso.org/schemas/ali/1.0/">https://creativecommons.org/licenses/by-sa/4.0/</ali:license_ref>
</license>
</permissions>
<abstract>
<p>Minnesota, particularly the City of Saint Paul, has seen a surge in
climate resilience funding aimed at expanding green energy job
opportunities. However, BIPOC communities remain underrepresented in
these jobs and disproportionately suffer from the adverse effects of
human-driven climate change.</p>
</abstract>
<kwd-group kwd-group-type="author">
<kwd>climate justice</kwd>
<kwd>climate-ready workforce</kwd>
<kwd>green jobs</kwd>
<kwd>climate change</kwd>
<kwd>equity</kwd>
</kwd-group>
</article-meta>
</front>
<body>
<sec id="background">
<title>Background</title>
<p>This analysis looks at access to green energy jobs (like energy
efficiency, renewable energy, and green construction) by
race/ethnicity, gender, education, and income in St. Paul, Minnesota,
USA.</p>
</sec>
<sec id="questions">
<title>Questions</title>
<p>Here are some of the questions I will explore using different
datasets:</p>
<list list-type="bullet">
<list-item>
<p>How much climate resilience funding has St. Paul received?</p>
</list-item>
<list-item>
<p>What specific green jobs are being created in St. Paul (e.g.,
energy efficiency, renewable energy, green construction)?</p>
</list-item>
<list-item>
<p>What is the quality of these jobs? How much do they pay? What
qualifications are needed (education and experience)?</p>
</list-item>
<list-item>
<p>Who is getting these jobs, based on education, race/ethnicity,
gender, and income levels?</p>
</list-item>
</list>
</sec>
<sec id="data-sources">
<title>Data Sources</title>
<p>The data for this project comes from:</p>
<list list-type="bullet">
<list-item>
<p>The National Center for O*NET Development</p>
</list-item>
<list-item>
<p>2023 Occupational Employment and Wage Survey</p>
</list-item>
<list-item>
<p>Urban Institute 11 elements of job quality: Clean Energy Job
Quality and Education Data</p>
</list-item>
<list-item>
<p>National and local demographic data from the 2022 American
Community Survey Public Use Microdata Sample (ACS PUMS)</p>
</list-item>
<list-item>
<p>US Census Bureau’s 2023 QuickFacts tool</p>
</list-item>
<list-item>
<p>Invest.gov</p>
</list-item>
<list-item>
<p>Geocorr from the Missouri Census Data Center</p>
</list-item>
</list>
<p>I will reduce each large dataset to focus only on questions related
to green jobs and job quality. Please note that some datasets have
already been pre-processed in Python with specific filters applied.
You can find the original raw datasets in the data folder for
reference.</p>
</sec>
<sec id="analysis">
<title>Analysis</title>
<p>I will look at each question one by one and clean the data as I go.
Some datasets might need to be combined, so I will organize the data
during the analysis before exploring the results.</p>
<sec id="load-packages-and-libraries">
<title>Load packages and libraries</title>
<code language="r script">## For folder structure
library(here)</code>
<preformat>here() starts at /Users/elhamali/Documents/Data Projects/climate-equity-workforce</preformat>
<code language="r script">library(ezknitr)
## For data import/cleaning
library(tidyverse)</code>
<preformat>── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2 </preformat>
<preformat>── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors</preformat>
<code language="r script">library(purrr)
library(rlang)</code>
<preformat>
Attaching package: 'rlang'
The following objects are masked from 'package:purrr':
%@%, flatten, flatten_chr, flatten_dbl, flatten_int, flatten_lgl,
flatten_raw, invoke, splice</preformat>
<code language="r script">library(forcats)
library(readxl)
## For graphing
library(highcharter)</code>
<preformat>Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo </preformat>
<code language="r script">library(igraph)</code>
<preformat>
Attaching package: 'igraph'
The following object is masked from 'package:rlang':
is_named
The following objects are masked from 'package:lubridate':
%--%, union
The following objects are masked from 'package:dplyr':
as_data_frame, groups, union
The following objects are masked from 'package:purrr':
compose, simplify
The following object is masked from 'package:tidyr':
crossing
The following object is masked from 'package:tibble':
as_data_frame
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union</preformat>
<code language="r script">library(RColorBrewer)
library(htmlwidgets)
library(gt)
# library(viridis)</code>
</sec>
<sec id="climate-resilience-funding-for-st.-paul">
<title>1. Climate Resilience Funding for St. Paul</title>
<boxed-text>
<p><bold>RQ 1: How much climate resilience funding has the City of
Saint Paul received?</bold></p>
<p>As of June 2024, <bold>Minnesota</bold> received a total of
$7,101,423,527 in funding for climate resilience, while
<bold>St. Paul</bold> received $446,286,762. Specifically, as of
January 2024, St. Paul has secured $433,028,012 from the Bipartisan
Infrastructure Law (BIL) and $13,258,750 from the Inflation
Reduction Act (IRA) for <bold>climate resilience efforts.</bold></p>
<p>St. Paul’s funding makes up <bold>6.28%</bold> of Minnesota’s
total climate resilience funding. Nearly <bold>95% of St. Paul’s
funding i</bold>s allocated to <bold>transportation</bold>
<bold>projects</bold>, with clean energy, buildings, and
manufacturing receiving <bold>less than 2% of the total</bold>. It’s
like filling up a swimming pool with water but using only a small 8
oz glass for clean energy, buildings, and manufacturing.</p>
<p>As of January 2024, St. Paul received <bold>$8,337,843 from the
BIL</bold> and <bold>$200,000 from the IRA</bold> specifically for
investments in clean energy, buildings, and manufacturing.</p>
</boxed-text>
<code language="r script"># Import data
funding <- read_csv(here("processed_data", "FundingSummary.csv"))</code>
<preformat>Warning: One or more parsing issues, call `problems()` on your data frame for details,
e.g.:
dat <- vroom(...)
problems(dat)</preformat>
<preformat>Rows: 49535 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (14): Agency Name, Bureau Name, Program Name, Category, Subcategory, Pro...
dbl (1): Unique ID
ℹ 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.</preformat>
<code language="r script">saveRDS(funding, here("processed_data", "funding.rds"))
funding <- readRDS(here("processed_data", "funding.rds"))</code>
<code language="r script">### Convert the `Funding Amount` to numeric and handling commas in the values
funding <- funding %>%
mutate(`Funding Amount` = as.numeric(gsub(",", "", `Funding Amount`)))</code>
<preformat>Warning: There was 1 warning in `mutate()`.
ℹ In argument: `Funding Amount = as.numeric(gsub(",", "", `Funding Amount`))`.
Caused by warning:
! NAs introduced by coercion</preformat>
<sec id="filter-for-mn-state-and-city-of-st.-paul">
<title>Filter for MN State and City of St. Paul</title>
<p>First, I will filter the dataset by State:
<bold>Minnesota</bold>, and then narrow it down further to focus
on the <bold>City of St. Paul</bold> and the surrounding region.
Please note that St. Paul is part of the
<bold>Minneapolis-St. Paul-Bloomington, MN-WI</bold> region, so
I’ll ensure it’s included within that larger metropolitan
area.</p>
<code language="r script"># Filter for Minnesota funding
minnesota_funding <- funding %>%
filter(State == "Minnesota")
saveRDS(minnesota_funding, here("processed_data", "minnesota_funding.rds"))</code>
<code language="r script"># Further filter for St. Paul, considering variations in city names
st_paul_funding <- minnesota_funding %>%
filter(str_detect(City, regex("Saint Paul|St. Paul|South St. Paul|Minneapolis--St. Paul|Minneapolis-St. Paul", ignore_case = TRUE)))
saveRDS(st_paul_funding, here("processed_data", "st_paul_funding.rds"))
# glimpse(st_paul_funding)</code>
</sec>
<sec id="calculate-funding-for-mn-state-and-city-of-st.-paul">
<title>Calculate funding for MN State and City of St. Paul</title>
<code language="r script"># Set options to avoid scientific notation
options(scipen = 999)
# Load Minnesota and St. Paul data
minnesota_funding <- readRDS(here("processed_data", "minnesota_funding.rds"))
st_paul_funding <- readRDS(here("processed_data", "st_paul_funding.rds"))
# Calculate total funding for Minnesota
total_minnesota_funding <- minnesota_funding %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE))
cat("The total amount of funding Minnesota received for climate as of June 2024 is $",
format(total_minnesota_funding$total_funding, big.mark = ","), "\n")</code>
<preformat>The total amount of funding Minnesota received for climate as of June 2024 is $ 7,101,423,527 </preformat>
<code language="r script"># Calculate total funding for St. Paul
total_st_paul_funding <- st_paul_funding %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE))
cat("The total amount of funding St. Paul received for climate as of June 2024 is $",
format(total_st_paul_funding$total_funding, big.mark = ","), "\n")</code>
<preformat>The total amount of funding St. Paul received for climate as of June 2024 is $ 446,286,762 </preformat>
<code language="r script"># Calculate total funds by funding source for St. Paul
source_st_paul_funding <- st_paul_funding %>%
group_by(`Funding Source`) %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE))
# Calculate specific totals for BIL and IRA
bil_funding <- st_paul_funding %>%
filter(`Funding Source` == "BIL") %>%
summarise(total_bil = sum(`Funding Amount`, na.rm = TRUE))
ira_funding <- st_paul_funding %>%
filter(`Funding Source` == "IRA") %>%
summarise(total_ira = sum(`Funding Amount`, na.rm = TRUE))
# Print specific funding from BIL and IRA
cat("As of January 2024, St. Paul has been allocated $",
format(bil_funding$total_bil, big.mark = ",", scientific = FALSE),
" from the Bipartisan Infrastructure Law (BIL) and $",
format(ira_funding$total_ira, big.mark = ",", scientific = FALSE),
" from the Inflation Reduction Act (IRA).\n")</code>
<preformat>As of January 2024, St. Paul has been allocated $ 433,028,012 from the Bipartisan Infrastructure Law (BIL) and $ 13,258,750 from the Inflation Reduction Act (IRA).</preformat>
<code language="r script"># Filter for the specific category 'Clean Energy, Buildings, and Manufacturing'
st_paul_clean_energy_funding <- st_paul_funding %>%
filter(Category == "Clean Energy, Buildings, and Manufacturing")
# Calculate total funds by funding source for the specific category
source_st_paul_clean_energy_funding <- st_paul_clean_energy_funding %>%
group_by(`Funding Source`) %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE))
# Calculate total funding across all sources for the specific category
total_st_paul_clean_energy_funding <- st_paul_clean_energy_funding %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE))
# Calculate specific totals for BIL and IRA in the specific category
bil_clean_energy_funding <- st_paul_clean_energy_funding %>%
filter(`Funding Source` == "BIL") %>%
summarise(total_bil = sum(`Funding Amount`, na.rm = TRUE))
ira_clean_energy_funding <- st_paul_clean_energy_funding %>%
filter(`Funding Source` == "IRA") %>%
summarise(total_ira = sum(`Funding Amount`, na.rm = TRUE))
# Print the total amount of funding for the specific category
cat("The total amount of funding St. Paul received for 'Clean Energy, Buildings, and Manufacturing' as of June 2024 is $",
format(total_st_paul_clean_energy_funding$total_funding, big.mark = ","), "\n")</code>
<preformat>The total amount of funding St. Paul received for 'Clean Energy, Buildings, and Manufacturing' as of June 2024 is $ 8,537,843 </preformat>
<code language="r script"># Print specific funding from BIL and IRA for the specific category
cat("As of January 2024, St. Paul has been allocated $",
format(bil_clean_energy_funding$total_bil, big.mark = ",", scientific = FALSE),
" from the Bipartisan Infrastructure Law (BIL) and $",
format(ira_clean_energy_funding$total_ira, big.mark = ",", scientific = FALSE),
" from the Inflation Reduction Act (IRA) to invest in 'Clean Energy, Buildings, and Manufacturing'.\n")</code>
<preformat>As of January 2024, St. Paul has been allocated $ 8,337,843 from the Bipartisan Infrastructure Law (BIL) and $ 200,000 from the Inflation Reduction Act (IRA) to invest in 'Clean Energy, Buildings, and Manufacturing'.</preformat>
<p>As of January 2024, St. Paul has been allocated $ 433,028,012
million from the Bipartisan Infrastructure Law (BIL) and $
13,258,750 from the Inflation Reduction Act (IRA) to invest in
climate resilience efforts in total.</p>
<p>As of January 2024, St. Paul has been allocated $ 8,337,843
million from the Bipartisan Infrastructure Law (BIL) and $ 200,000
from the Inflation Reduction Act (IRA) to invest in ‘Clean Energy,
Buildings, and Manufacturing’.</p>
</sec>
<sec id="calculate-fraction-of-st.-pauls-funding-from-mns">
<title>Calculate fraction of St. Paul’s funding from MN’s</title>
<code language="r script">minnesota_funding <- readRDS(here("processed_data", "minnesota_funding.rds"))
st_paul_funding <- readRDS(here("processed_data", "st_paul_funding.rds"))
# Calculate total funding for Minnesota
total_minnesota_funding <- minnesota_funding %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE)) %>%
pull(total_funding)
# Calculate total funding for St. Paul
total_st_paul_funding <- st_paul_funding %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE)) %>%
pull(total_funding)
# Calculate the fraction of St. Paul's funding from Minnesota's total funding
fraction_st_paul <- total_st_paul_funding / total_minnesota_funding
# Output the results
cat("The fraction of St. Paul's funding from Minnesota's total funding is: ",
round(fraction_st_paul, 4), "\n")</code>
<preformat>The fraction of St. Paul's funding from Minnesota's total funding is: 0.0628 </preformat>
<code language="r script">cat("This means St. Paul's funding is", round(fraction_st_paul * 100, 2), "% of Minnesota's total funding.\n")</code>
<preformat>This means St. Paul's funding is 6.28 % of Minnesota's total funding.</preformat>
</sec>
<sec id="visualize-categories-of-funding-for-st.-paul">
<title>Visualize categories of funding for St. Paul</title>
<code language="r script"># Group the St. Paul data by Category and calculate the total funding for each category
st_paul_category_funding <- st_paul_funding %>%
group_by(Category) %>%
summarise(total_funding = sum(`Funding Amount`, na.rm = TRUE)) %>%
arrange(desc(total_funding))
colors <- brewer.pal(n = length(unique(st_paul_category_funding$Category)), "Set3")
# Create an interactive bar chart using highcharter
hchart_bar <- highchart() %>%
hc_chart(type = "bar") %>%
hc_xAxis(categories = st_paul_category_funding$Category, title = list(text = "Category")) %>%
hc_yAxis(title = list(text = "Total Funding ($)"), labels = list(format = "{value:,.0f}")) %>%
hc_add_series(name = "Total Funding",
data = st_paul_category_funding$total_funding,
colorByPoint = TRUE,
colors = colors) %>%
hc_title(text = "Total Funding by Category in St. Paul") %>%
hc_tooltip(pointFormat = "Total Funding: ${point.y:,.0f}") %>%
hc_exporting(
enabled = TRUE,
buttons = list(contextButton = list(menuItems = c("downloadPNG", "downloadJPEG", "downloadSVG", "downloadPDF")))
)
# Saving the chart as an HTML file
saveWidget(hchart_bar, file = here("graphs", "st_paul_funding_bar.html"))</code>
<p>A quick glance tells us that almost <bold>95%</bold> of
St. Paul’s funding goes to transportation efforts. Clean energy,
buildings and manufacturing received less than <bold>2%</bold> of
funding.</p>
<code language="r script"># Create an interactive pie chart using highcharter
hchart_pie <- highchart() %>%
hc_chart(type = "pie") %>%
hc_add_series(name = "Total Funding",
data = list_parse2(st_paul_category_funding %>%
mutate(name = Category, y = total_funding)),
colors = colors) %>%
hc_title(text = "Total Funding by Category in St. Paul") %>%
hc_tooltip(pointFormat = "Total Funding: ${point.y:,.0f}") %>%
hc_plotOptions(pie = list(innerSize = '50%', dataLabels = list(enabled = TRUE))) %>%
hc_exporting(
enabled = TRUE,
buttons = list(contextButton = list(menuItems = c("downloadPNG", "downloadJPEG", "downloadSVG", "downloadPDF")))
)
saveWidget(hchart_pie, file = here("graphs", "st_paul_funding_pie.html"))</code>
<code language="r script">## Export the funding data to CSV for graphing
write.csv(minnesota_funding, here("processed_data", "minnesota_funding.csv"), row.names = FALSE)
write.csv(st_paul_funding, here("processed_data", "st_paul_funding.csv"), row.names = FALSE)</code>
</sec>
</sec>
<sec id="types-of-green-jobs-in-st.-paul">
<title>2. Types of Green Jobs in St. Paul</title>
<boxed-text>
<p><bold>RQ 2: What specific green jobs are being created in the
Minneapolis-Saint Paul metropolitan area and nationally (e.g.,
energy efficiency, renewable energy, green construction)?</bold></p>
<p><underline>Nationally</underline></p>
<p>There’s a total of <bold>17,119,730 employed people</bold> in
green jobs nationally. Specifically, in <bold>Energy
Efficiency</bold>, there are 4,928,520 (28.79 %), in <bold>Green
Construction</bold> there are 10,624,140 (62.06 %), and in
<bold>Renewable Energy Generation</bold> there are 1,567,070 (9.15
%).</p>
<p>The <bold>mean annual wage</bold> for the occupation in U.S.
dollars for green jobs is $78,363.4, and for non-green jobs is
$73,763.67. That means green jobs pay <bold>$4,599.73 more</bold>
than non-green jobs <bold>nationally</bold>.</p>
<p>The <bold>mean hourly wage</bold> for the occupation in U.S.
dollars for green jobs is $37.67547, and for non-green jobs is
$34.80. That means green jobs pay <bold>$2.88 more</bold> than
non-green jobs <bold>nationally</bold>.</p>
<p><underline>Minneapolis-Saint Paul Metropolitan
Area</underline></p>
<p>There’s a total of <bold>214,340 employed people</bold> in green
jobs in the Minneapolis-Saint Paul metropolitan area. Specifically,
in <bold>Energy Efficiency</bold>, there are 66,410 ( 30.98 %), in
<bold>Green Construction</bold> there are 124,680 ( 58.17 %), and in
<bold>Renewable Energy Generation</bold> there are 23,250 ( 10.85
%).</p>
<p>The <bold>mean annual wage</bold> for the occupation in U.S.
dollars for green jobs <bold>in this area</bold> is $84,561.7, and
for non-green jobs is $77,192.53. That means green jobs in Saint
Paul pay $7,369.169 more than non-green jobs in this area.</p>
<p>The <bold>mean hourly wage</bold> for the occupation in U.S.
dollars for green jobs <bold>in this area</bold> is $40.65, and for
non-green jobs is $36.31. That means green jobs in Saint Paul pay
<bold>$4.35 more</bold> than non-green jobs in this area.</p>
</boxed-text>
<sec id="green-jobs-nationally">
<title>Green jobs nationally</title>
<code language="r script"># Import national jobs data
national_jobs <- read_csv(here("processed_data", "OWES_and_ONET-National.csv"))</code>
<preformat>Rows: 1420 Columns: 34
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (21): AREA_TITLE, PRIM_STATE, NAICS_TITLE, I_GROUP, OCC_CODE, OCC_TITLE,...
dbl (7): AREA, AREA_TYPE, NAICS, OWN_CODE, TOT_EMP, EMP_PRSE, MEAN_PRSE
lgl (6): JOBS_1000, LOC_QUOTIENT, PCT_TOTAL, PCT_RPT, ANNUAL, HOURLY
ℹ 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.</preformat>
<code language="r script">saveRDS(national_jobs, here("processed_data", "national_jobs.rds"))
national_jobs <- readRDS(here("processed_data", "national_jobs.rds"))</code>
<p>Here, we’d want to filter to only green jobs</p>
<code language="r script"># Convert necessary columns to numeric where needed
national_jobs <- national_jobs %>%
mutate(
TOT_EMP = as.numeric(TOT_EMP),
# JOBS_1000 = as.numeric(JOBS_1000),
# PCT_TOTAL = as.numeric(PCT_TOTAL),
H_MEAN = as.numeric(H_MEAN),
A_MEAN = as.numeric(A_MEAN),
A_MEDIAN = as.numeric(A_MEDIAN),
H_MEDIAN = as.numeric(H_MEDIAN)
)</code>
<preformat>Warning: There were 4 warnings in `mutate()`.
The first warning was:
ℹ In argument: `H_MEAN = as.numeric(H_MEAN)`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 3 remaining warnings.</preformat>
<code language="r script"># Filter the dataset to include only relevant sectors
filtered_jobs <- national_jobs %>%
filter(`O*NET-SOC Sector` %in% c("Energy Efficiency", "Renewable Energy Generation", "Green Construction"))
# Function to summarize data for each sector
summarize_by_sector <- function(df) {
df %>%
summarize(
TOT_EMP = sum(TOT_EMP, na.rm = TRUE),
# JOBS_1000 = sum(JOBS_1000 * TOT_EMP, na.rm = TRUE) / sum(TOT_EMP, na.rm = TRUE),
# PCT_TOTAL = sum(PCT_TOTAL * TOT_EMP, na.rm = TRUE) / sum(TOT_EMP, na.rm = TRUE),
H_MEAN = mean(H_MEAN, na.rm = TRUE),
A_MEAN = mean(A_MEAN, na.rm = TRUE),
A_MEDIAN = median(A_MEDIAN, na.rm = TRUE),
H_MEDIAN = median(H_MEDIAN, na.rm = TRUE)
)
}
# Summarize the data for each sector and overall
sector_summary <- filtered_jobs %>%
group_by(`O*NET-SOC Sector`) %>%
summarize_by_sector()
# Calculate the summary for all sectors combined
overall_summary <- filtered_jobs %>%
summarize_by_sector()
# Combine the results: sector-wise and overall
final_summary <- bind_rows(sector_summary, tibble(`O*NET-SOC Sector` = "All", overall_summary))
# Save the final summary as an RDS file and CSV for future reference
saveRDS(final_summary, here("processed_data", "sector_summary.rds"))
write_csv(final_summary, here("processed_data", "sector_summary.csv"))
# Output the final summary to the user
print(final_summary)</code>
<preformat># A tibble: 4 × 6
`O*NET-SOC Sector` TOT_EMP H_MEAN A_MEAN A_MEDIAN H_MEDIAN
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Energy Efficiency 4928520 43.0 89371 86355 41.5
2 Green Construction 10624140 33.9 70506. 60165 28.9
3 Renewable Energy Generation 1567070 42.3 88028. 97010 46.6
4 All 17119730 37.7 78363. 67640 32.5</preformat>
<code language="r script"># Calculate total employment and sector percentages
total_green_jobs <- final_summary %>% filter(`O*NET-SOC Sector` == "All") %>% pull(TOT_EMP)
energy_efficiency_jobs <- final_summary %>% filter(`O*NET-SOC Sector` == "Energy Efficiency") %>% pull(TOT_EMP)
green_construction_jobs <- final_summary %>% filter(`O*NET-SOC Sector` == "Green Construction") %>% pull(TOT_EMP)
renewable_energy_jobs <- final_summary %>% filter(`O*NET-SOC Sector` == "Renewable Energy Generation") %>% pull(TOT_EMP)
# Calculate the percentages
energy_efficiency_pct <- round((energy_efficiency_jobs / total_green_jobs) * 100, 2)
green_construction_pct <- round((green_construction_jobs / total_green_jobs) * 100, 2)
renewable_energy_pct <- round((renewable_energy_jobs / total_green_jobs) * 100, 2)
# Create the concatenated sentence
cat("There's a total of", format(total_green_jobs, big.mark = ",", scientific = FALSE),
"employed people in green jobs nationally. Specifically, in Energy Efficiency, there are",
format(energy_efficiency_jobs, big.mark = ",", scientific = FALSE),
"(", energy_efficiency_pct, "%), in Green Construction there are",
format(green_construction_jobs, big.mark = ",", scientific = FALSE),
"(", green_construction_pct, "%), and in Renewable Energy Generation there are",
format(renewable_energy_jobs, big.mark = ",", scientific = FALSE),
"(", renewable_energy_pct, "%).\n")</code>
<preformat>There's a total of 17,119,730 employed people in green jobs nationally. Specifically, in Energy Efficiency, there are 4,928,520 ( 28.79 %), in Green Construction there are 10,624,140 ( 62.06 %), and in Renewable Energy Generation there are 1,567,070 ( 9.15 %).</preformat>
<p>Let’s visualize this so it’s easier to compare across all green
sectors</p>
<code language="r script"># Convert the O*NET-SOC Sector to a factor for ordering in the chart
final_summary <- final_summary %>%
mutate(`O*NET-SOC Sector` = factor(`O*NET-SOC Sector`, levels = c("Energy Efficiency", "Green Construction", "Renewable Energy Generation", "All")))
# Visualizing TOT_EMP across the sectors
hchart(final_summary, "column", hcaes(x = `O*NET-SOC Sector`, y = TOT_EMP)) %>%
hc_title(text = "Total Employment by Sector") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Total Employment"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f}</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-13-1.png" />
<code language="r script"># Visualizing H_MEAN (Mean Hourly Wage) across the sectors
hchart(final_summary, "column", hcaes(x = `O*NET-SOC Sector`, y = H_MEAN)) %>%
hc_title(text = "Mean Hourly Wage by Sector") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Mean Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-13-2.png" />
<code language="r script"># Visualizing A_MEAN (Mean Annual Wage) across the sectors
hchart(final_summary, "column", hcaes(x = `O*NET-SOC Sector`, y = A_MEAN)) %>%
hc_title(text = "Mean Annual Wage by Sector") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Mean Annual Wage (USD)"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-13-3.png" />
<code language="r script"># Visualizing A_MEDIAN (Median Annual Wage) across the sectors
hchart(final_summary, "column", hcaes(x = `O*NET-SOC Sector`, y = A_MEDIAN)) %>%
hc_title(text = "Median Annual Wage by Sector") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Median Annual Wage (USD)"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-13-4.png" />
<code language="r script"># Visualizing H_MEDIAN (Median Hourly Wage) across the sectors
hchart(final_summary, "column", hcaes(x = `O*NET-SOC Sector`, y = H_MEDIAN)) %>%
hc_title(text = "Median Hourly Wage by Sector") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Median Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-13-5.png" />
<p>I’m also curious about the differences between green jobs and
non-green jobs for mean hourly wage and mean annual wage.</p>
<code language="r script"># Define green jobs as sectors related to energy and construction
green_jobs_sectors <- c("Energy Efficiency", "Renewable Energy Generation", "Green Construction")
# Add a new column to identify green and non-green jobs
national_jobs <- national_jobs %>%
mutate(
Job_Type = ifelse(`O*NET-SOC Sector` %in% green_jobs_sectors, "Green Jobs", "Non-Green Jobs")
)
# Group by job type (Green vs Non-Green) and calculate mean wages
job_type_summary <- national_jobs %>%
group_by(Job_Type) %>%
summarize(
H_MEAN = mean(H_MEAN, na.rm = TRUE),
A_MEAN = mean(A_MEAN, na.rm = TRUE)
)
# Visualizing Mean Hourly Wage (H_MEAN) for Green vs Non-Green Jobs
hchart(job_type_summary, "column", hcaes(x = Job_Type, y = H_MEAN)) %>%
hc_title(text = "Mean Hourly Wage: Green Jobs vs Non-Green Jobs") %>%
hc_xAxis(title = list(text = "Job Type")) %>%
hc_yAxis(title = list(text = "Mean Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-14-1.png" />
<code language="r script"># Visualizing Mean Annual Wage (A_MEAN) for Green vs Non-Green Jobs
hchart(job_type_summary, "column", hcaes(x = Job_Type, y = A_MEAN)) %>%
hc_title(text = "Mean Annual Wage: Green Jobs vs Non-Green Jobs") %>%
hc_xAxis(title = list(text = "Job Type")) %>%
hc_yAxis(title = list(text = "Mean Annual Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-14-2.png" />
<code language="r script"># Summarizing core findings nationally
# Extract green and non-green job wage data
green_wages <- job_type_summary %>% filter(Job_Type == "Green Jobs")
non_green_wages <- job_type_summary %>% filter(Job_Type == "Non-Green Jobs")
# Calculate the difference between green and non-green jobs
difference_annual <- green_wages$A_MEAN - non_green_wages$A_MEAN
difference_hourly <- green_wages$H_MEAN - non_green_wages$H_MEAN
# Format and print the sentences
cat("The mean annual wage for the occupation in U.S. dollars for green jobs is $",
format(green_wages$A_MEAN, big.mark = ",", scientific = FALSE),
", and for non-green jobs is $",
format(non_green_wages$A_MEAN, big.mark = ",", scientific = FALSE),
". That means green jobs pay $",
format(abs(difference_annual), big.mark = ",", scientific = FALSE),
ifelse(difference_annual > 0, " more", " less"),
" than non-green jobs nationally.\n", sep = "")</code>
<preformat>The mean annual wage for the occupation in U.S. dollars for green jobs is $78,363.4, and for non-green jobs is $73,763.67. That means green jobs pay $4,599.726 more than non-green jobs nationally.</preformat>
<code language="r script">cat("The mean hourly wage for the occupation in U.S. dollars for green jobs is $",
format(green_wages$H_MEAN, big.mark = ",", scientific = FALSE),
", and for non-green jobs is $",
format(non_green_wages$H_MEAN, big.mark = ",", scientific = FALSE),
". That means green jobs pay $",
format(abs(difference_hourly), big.mark = ",", scientific = FALSE),
ifelse(difference_hourly > 0, " more", " less"),
" than non-green jobs nationally.\n", sep = "")</code>
<preformat>The mean hourly wage for the occupation in U.S. dollars for green jobs is $37.67547, and for non-green jobs is $34.79641. That means green jobs pay $2.879063 more than non-green jobs nationally.</preformat>
<p>I’d like to see a word cloud of different job titles for each
sector</p>
<code language="r script"># Filter the dataset for green jobs only
green_jobs <- national_jobs %>%
filter(`O*NET-SOC Sector` %in% c("Energy Efficiency", "Renewable Energy Generation", "Green Construction"))
# Extract job titles and count their occurrences
job_titles <- green_jobs %>%
count(OCC_TITLE, sort = TRUE)
# Create a word cloud using highcharter
hchart(
job_titles,
"wordcloud",
hcaes(name = OCC_TITLE, weight = n)
) %>%
hc_title(text = "Word Cloud of Green Job Titles")</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-16-1.png" />
<p>Now let’s create separate word clouds for each of the green
sectors (“Energy Efficiency”, “Renewable Energy Generation”, and
“Green Construction”).</p>
<code language="r script"># Filter the dataset for each sector
energy_efficiency_jobs <- national_jobs %>%
filter(`O*NET-SOC Sector` == "Energy Efficiency")
renewable_energy_jobs <- national_jobs %>%
filter(`O*NET-SOC Sector` == "Renewable Energy Generation")
green_construction_jobs <- national_jobs %>%
filter(`O*NET-SOC Sector` == "Green Construction")
# Create a function to generate word clouds
generate_wordcloud <- function(data, sector_name) {
job_titles <- data %>%
count(OCC_TITLE, sort = TRUE)
hchart(
job_titles,
"wordcloud",
hcaes(name = OCC_TITLE, weight = n)
) %>%
hc_title(text = paste("Word Cloud of", sector_name, "Job Titles"))
}
# Generate word cloud for Energy Efficiency
energy_efficiency_wordcloud <- generate_wordcloud(energy_efficiency_jobs, "Energy Efficiency")
# Generate word cloud for Renewable Energy Generation
renewable_energy_wordcloud <- generate_wordcloud(renewable_energy_jobs, "Renewable Energy Generation")
# Generate word cloud for Green Construction
green_construction_wordcloud <- generate_wordcloud(green_construction_jobs, "Green Construction")
# Display the word clouds
energy_efficiency_wordcloud</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-17-1.png" />
<code language="r script">renewable_energy_wordcloud</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-17-2.png" />
<code language="r script">green_construction_wordcloud</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-17-3.png" />
<p>Let’s export for graphing</p>
<code language="r script">## Export the national jobs data to CSV for graphing
write.csv(national_jobs, here("processed_data", "national_jobs.csv"), row.names = FALSE)
# Export the job_type_summary dataset to CSV for graphing
write.csv(job_type_summary, here("processed_data", "national_job_type_summary.csv"), row.names = FALSE)</code>
</sec>
<sec id="green-jobs-in-st.-paul">
<title>Green jobs in St. Paul</title>
<code language="r script"># Import St. Paul jobs data
st_paul_jobs <- read_csv(here("processed_data", "OWES_and_ONET-St_Paul.csv"))</code>
<preformat>Rows: 742 Columns: 34
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (26): AREA_TITLE, PRIM_STATE, NAICS_TITLE, I_GROUP, OCC_CODE, OCC_TITLE,...
dbl (4): AREA, AREA_TYPE, NAICS, OWN_CODE
lgl (4): PCT_TOTAL, PCT_RPT, ANNUAL, HOURLY
ℹ 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.</preformat>
<code language="r script">saveRDS(st_paul_jobs, here("processed_data", "st_paul_jobs.rds"))
st_paul_jobs <- readRDS(here("processed_data", "st_paul_jobs.rds"))</code>
<code language="r script"># Convert necessary columns to numeric where needed
st_paul_jobs <- st_paul_jobs %>%
mutate(
TOT_EMP = as.numeric(TOT_EMP),
H_MEAN = as.numeric(H_MEAN),
A_MEAN = as.numeric(A_MEAN),
A_MEDIAN = as.numeric(A_MEDIAN),
H_MEDIAN = as.numeric(H_MEDIAN)
)</code>
<preformat>Warning: There were 5 warnings in `mutate()`.
The first warning was:
ℹ In argument: `TOT_EMP = as.numeric(TOT_EMP)`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 4 remaining warnings.</preformat>
<code language="r script"># Filter the dataset to include only relevant green sectors
filtered_st_paul_jobs <- st_paul_jobs %>%
filter(`O*NET-SOC Sector` %in% c("Energy Efficiency", "Renewable Energy Generation", "Green Construction"))
# Function to summarize data for each sector
summarize_by_sector <- function(df) {
df %>%
summarize(
TOT_EMP = sum(TOT_EMP, na.rm = TRUE),
H_MEAN = mean(H_MEAN, na.rm = TRUE),
A_MEAN = mean(A_MEAN, na.rm = TRUE),
A_MEDIAN = median(A_MEDIAN, na.rm = TRUE),
H_MEDIAN = median(H_MEDIAN, na.rm = TRUE)
)
}
# Summarize the data for each sector and overall
sector_summary_st_paul <- filtered_st_paul_jobs %>%
group_by(`O*NET-SOC Sector`) %>%
summarize_by_sector()
# Calculate the summary for all sectors combined
overall_summary_st_paul <- filtered_st_paul_jobs %>%
summarize_by_sector()
# Combine the results: sector-wise and overall
final_summary_st_paul <- bind_rows(sector_summary_st_paul, tibble(`O*NET-SOC Sector` = "All", overall_summary_st_paul))
# Save the final summary as an RDS file and CSV for future reference
saveRDS(final_summary_st_paul, here("processed_data", "sector_summary_st_paul.rds"))
write_csv(final_summary_st_paul, here("processed_data", "sector_summary_st_paul.csv"))
# Output the final summary to the user
print(final_summary_st_paul)</code>
<preformat># A tibble: 4 × 6
`O*NET-SOC Sector` TOT_EMP H_MEAN A_MEAN A_MEDIAN H_MEDIAN
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Energy Efficiency 66410 45.5 94669. 98740 47.5
2 Green Construction 124680 37.9 78809. 75800 36.4
3 Renewable Energy Generation 23250 44.7 92991. 99690 47.9
4 All 214340 40.7 84562. 82170 39.5</preformat>
<code language="r script"># Calculate total employment and sector percentages for St. Paul
total_green_jobs_st_paul <- final_summary_st_paul %>% filter(`O*NET-SOC Sector` == "All") %>% pull(TOT_EMP)
energy_efficiency_jobs_st_paul <- final_summary_st_paul %>% filter(`O*NET-SOC Sector` == "Energy Efficiency") %>% pull(TOT_EMP)
green_construction_jobs_st_paul <- final_summary_st_paul %>% filter(`O*NET-SOC Sector` == "Green Construction") %>% pull(TOT_EMP)
renewable_energy_jobs_st_paul <- final_summary_st_paul %>% filter(`O*NET-SOC Sector` == "Renewable Energy Generation") %>% pull(TOT_EMP)
# Calculate the percentages
energy_efficiency_pct_st_paul <- round((energy_efficiency_jobs_st_paul / total_green_jobs_st_paul) * 100, 2)
green_construction_pct_st_paul <- round((green_construction_jobs_st_paul / total_green_jobs_st_paul) * 100, 2)
renewable_energy_pct_st_paul <- round((renewable_energy_jobs_st_paul / total_green_jobs_st_paul) * 100, 2)
# Create the concatenated sentence for St. Paul
cat("There's a total of", format(total_green_jobs_st_paul, big.mark = ",", scientific = FALSE),
"employed people in green jobs in Saint Paul. Specifically, in Energy Efficiency, there are",
format(energy_efficiency_jobs_st_paul, big.mark = ",", scientific = FALSE),
"(", energy_efficiency_pct_st_paul, "%), in Green Construction there are",
format(green_construction_jobs_st_paul, big.mark = ",", scientific = FALSE),
"(", green_construction_pct_st_paul, "%), and in Renewable Energy Generation there are",
format(renewable_energy_jobs_st_paul, big.mark = ",", scientific = FALSE),
"(", renewable_energy_pct_st_paul, "%).\n")</code>
<preformat>There's a total of 214,340 employed people in green jobs in Saint Paul. Specifically, in Energy Efficiency, there are 66,410 ( 30.98 %), in Green Construction there are 124,680 ( 58.17 %), and in Renewable Energy Generation there are 23,250 ( 10.85 %).</preformat>
<code language="r script"># Visualizing TOT_EMP across the green sectors for St. Paul
final_summary_st_paul <- final_summary_st_paul %>%
mutate(`O*NET-SOC Sector` = factor(`O*NET-SOC Sector`, levels = c("Energy Efficiency", "Green Construction", "Renewable Energy Generation", "All")))
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = TOT_EMP)) %>%
hc_title(text = "Total Employment by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Total Employment"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f}</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-20-1.png" />
<code language="r script"># Convert the O*NET-SOC Sector to a factor for ordering in the chart for St. Paul
final_summary_st_paul <- final_summary_st_paul %>%
mutate(`O*NET-SOC Sector` = factor(`O*NET-SOC Sector`, levels = c("Energy Efficiency", "Green Construction", "Renewable Energy Generation", "All")))
# Visualizing TOT_EMP across the sectors for St. Paul
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = TOT_EMP)) %>%
hc_title(text = "Total Employment by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Total Employment"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f}</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-1.png" />
<code language="r script"># Visualizing H_MEAN (Mean Hourly Wage) across the sectors for St. Paul
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = H_MEAN)) %>%
hc_title(text = "Mean Hourly Wage by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Mean Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-2.png" />
<code language="r script"># Visualizing A_MEAN (Mean Annual Wage) across the sectors for St. Paul
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = A_MEAN)) %>%
hc_title(text = "Mean Annual Wage by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Mean Annual Wage (USD)"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-3.png" />
<code language="r script"># Visualizing A_MEDIAN (Median Annual Wage) across the sectors for St. Paul
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = A_MEDIAN)) %>%
hc_title(text = "Median Annual Wage by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Median Annual Wage (USD)"), labels = list(format = "{value:,0f}")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-4.png" />
<code language="r script"># Visualizing H_MEDIAN (Median Hourly Wage) across the sectors for St. Paul
hchart(final_summary_st_paul, "column", hcaes(x = `O*NET-SOC Sector`, y = H_MEDIAN)) %>%
hc_title(text = "Median Hourly Wage by Sector in Saint Paul") %>%
hc_xAxis(title = list(text = "Sector")) %>%
hc_yAxis(title = list(text = "Median Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-5.png" />
<code language="r script"># Define green jobs as sectors related to energy and construction for St. Paul
green_jobs_sectors_st_paul <- c("Energy Efficiency", "Renewable Energy Generation", "Green Construction")
# Add a new column to identify green and non-green jobs for St. Paul
st_paul_jobs <- st_paul_jobs %>%
mutate(
Job_Type = ifelse(`O*NET-SOC Sector` %in% green_jobs_sectors_st_paul, "Green Jobs", "Non-Green Jobs")
)
# Group by job type (Green vs Non-Green) and calculate mean wages for St. Paul
job_type_summary_st_paul <- st_paul_jobs %>%
group_by(Job_Type) %>%
summarize(
H_MEAN = mean(H_MEAN, na.rm = TRUE),
A_MEAN = mean(A_MEAN, na.rm = TRUE)
)
# Visualizing Mean Hourly Wage (H_MEAN) for Green vs Non-Green Jobs in St. Paul
hchart(job_type_summary_st_paul, "column", hcaes(x = Job_Type, y = H_MEAN)) %>%
hc_title(text = "Mean Hourly Wage: Green Jobs vs Non-Green Jobs in Saint Paul") %>%
hc_xAxis(title = list(text = "Job Type")) %>%
hc_yAxis(title = list(text = "Mean Hourly Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:.2f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-6.png" />
<code language="r script"># Visualizing Mean Annual Wage (A_MEAN) for Green vs Non-Green Jobs in St. Paul
hchart(job_type_summary_st_paul, "column", hcaes(x = Job_Type, y = A_MEAN)) %>%
hc_title(text = "Mean Annual Wage: Green Jobs vs Non-Green Jobs in Saint Paul") %>%
hc_xAxis(title = list(text = "Job Type")) %>%
hc_yAxis(title = list(text = "Mean Annual Wage (USD)")) %>%
hc_tooltip(pointFormat = '<b>{point.y:,0f} USD</b>')</code>
<graphic mimetype="image" mime-subtype="png" xlink:href="index_files/figure-jats/unnamed-chunk-21-7.png" />
<code language="r script"># Summarizing core findings for Saint Paul
# Extract green and non-green job wage data for St. Paul
green_wages_st_paul <- job_type_summary_st_paul %>% filter(Job_Type == "Green Jobs")
non_green_wages_st_paul <- job_type_summary_st_paul %>% filter(Job_Type == "Non-Green Jobs")
# Calculate the difference between green and non-green jobs for St. Paul
difference_annual_st_paul <- green_wages_st_paul$A_MEAN - non_green_wages_st_paul$A_MEAN
difference_hourly_st_paul <- green_wages_st_paul$H_MEAN - non_green_wages_st_paul$H_MEAN
# Format and print the sentences for Saint Paul
cat("The mean annual wage for the occupation in U.S. dollars for green jobs in Saint Paul is $",
format(green_wages_st_paul$A_MEAN, big.mark = ",", scientific = FALSE),
", and for non-green jobs is $",
format(non_green_wages_st_paul$A_MEAN, big.mark = ",", scientific = FALSE),
". That means green jobs in Saint Paul pay $",
format(abs(difference_annual_st_paul), big.mark = ",", scientific = FALSE),
ifelse(difference_annual_st_paul > 0, " more", " less"),
" than non-green jobs in Saint Paul.\n", sep = "")</code>
<preformat>The mean annual wage for the occupation in U.S. dollars for green jobs in Saint Paul is $84,561.7, and for non-green jobs is $77,192.53. That means green jobs in Saint Paul pay $7,369.169 more than non-green jobs in Saint Paul.</preformat>
<code language="r script">cat("The mean hourly wage for the occupation in U.S. dollars for green jobs in Saint Paul is $",
format(green_wages_st_paul$H_MEAN, big.mark = ",", scientific = FALSE),
", and for non-green jobs is $",
format(non_green_wages_st_paul$H_MEAN, big.mark = ",", scientific = FALSE),
". That means green jobs in Saint Paul pay $",
format(abs(difference_hourly_st_paul), big.mark = ",", scientific = FALSE),
ifelse(difference_hourly_st_paul > 0, " more", " less"),
" than non-green jobs in Saint Paul.\n", sep = "")</code>
<preformat>The mean hourly wage for the occupation in U.S. dollars for green jobs in Saint Paul is $40.65447, and for non-green jobs is $36.30688. That means green jobs in Saint Paul pay $4.347591 more than non-green jobs in Saint Paul.</preformat>
<p>I’d like to see a word cloud of different job titles for each
sector in St. Paul</p>
<code language="r script"># Filter the dataset for green jobs only in St. Paul