-
Notifications
You must be signed in to change notification settings - Fork 0
/
g2c_git.Rmd
1666 lines (1570 loc) · 116 KB
/
g2c_git.Rmd
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
---
title: "G2C data"
author: "<p>Jon Kawatachi</p>"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
theme: flatly
highlight: pygments
#css: styles.css
number_sections: false
fig_caption: true
---
```{r global_options, include=FALSE}
knitr::opts_chunk$set(warning=FALSE)
```
```{r message=FALSE, warning=FALSE, include=FALSE}
#Load library
library(Hmisc)
library(summarytools)
library(tidyverse)
library(readxl)
library(dplyr)
library(likert)
library(kableExtra)
library(formattable)
library(janitor)
library(openxlsx)
```
# Content
Studies:
Assessing Adolescents' Access to Food Assistance Programs during COVID-19 Pandemic - Adolescent Food Insecurity (Vanguard)
The influence of health on employment among young people in Baltimore - HEYBMORE (G2C)
1. Food Insecurity
2. Anxiety
3. PTSD / Trauma
4. Depression
5. Housing
## 1. Food Insecurity
```{r message=FALSE, warning=FALSE, include=FALSE}
# Import G2C REDCap data for comparison to Vanguard
redcap_g2c_labels=read.csv('/Users/jon/Downloads/TheInfluenceOfHealth_DATA_LABELS_2021-08-25_1547.csv')
redcap_g2c_raw1 = read.csv('/Users/jon/Downloads/TheInfluenceOfHealth_DATA_2021-08-25_1547.csv')
redcap_g2c_raw2 = dplyr::filter(redcap_g2c_raw1, heybmore_survey_complete==2)
redcap_g2c_raw2$name_first <- redcap_g2c_raw2$info_fn
redcap_g2c_raw2$name_last <- redcap_g2c_raw2$info_ln
redcap_g2c_raw2$dob <- redcap_g2c_raw2$dob
# ETO data - Cycle 2
eto2_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Demographics")
eto2_demo$subjectid <- eto2_demo$`Subject.Unique.Identifier`
eto2_demo$cycle <- eto2_demo$`Cycle:`
eto2_demo$name_first <- eto2_demo$`First.Name`
eto2_demo$name_last <- eto2_demo$`Last.Name`
eto2_demo$gender <- eto2_demo$`Gender_3753`
eto2_demo$ethnic <- eto2_demo$`Ethnicity-Custom`
eto2_demo$race <- eto2_demo$`Race-Custom`
eto2_demo$dob <- eto2_demo$DOB
eto2_demo$source <- "eto2"
eto2_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Enrolled Current Program")
eto2_prog$subjectid <- eto2_prog$ID
eto2_prog$program <- eto2_prog$`Current.Program`
# ETO data - Cycle 3
eto3_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Demographics")
eto3_demo$subjectid <- eto3_demo$`Subject.Id`
eto3_demo$cycle <- eto3_demo$`Cycle:`
eto3_demo$name_first <- eto3_demo$`First.Name`
eto3_demo$name_last <- eto3_demo$`Last.Name`
eto3_demo$gender <- eto3_demo$`Gender_3753`
eto3_demo$ethnic <- eto3_demo$`Ethnicity-Custom`
eto3_demo$race <- eto3_demo$`Race-Custom`
eto3_demo$dob <- eto3_demo$DOB
eto3_demo$source <- "eto3"
eto3_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Training")
eto3_prog$subjectid <- eto3_prog$SubjectID
eto3_prog$program <- eto3_prog$`Program.Name`
# Salesforce data
salesforce1 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210208 - unlocked.xlsx')
salesforce2 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210209 - unlocked.xlsx')
salesforce2$name_first <- salesforce2$`Contact:.First.Name`
salesforce2$name_last <- salesforce2$`Contact:.Last.Name`
salesforce2$gender_sales <- salesforce2$`Gender`
salesforce2$ethnic_sales <- salesforce2$`Ethnicity`
salesforce2$race_sales <- salesforce2$`Race`
salesforce2$source_sales <- "salesforce"
# Select variables from Salesforce data
salesforce3 <- dplyr::select(salesforce2, name_first, name_last, gender_sales, ethnic_sales, race_sales, source_sales)
# Select variables from ETO data
eto2_demo_select <- dplyr::select(eto2_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto2_prog_select <- dplyr::select(eto2_prog, subjectid, `program`)
eto2 <- left_join(eto2_demo_select, eto2_prog_select, by="subjectid")
eto3_demo_select <- dplyr::select(eto3_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto3_prog_select <- dplyr::select(eto3_prog, subjectid, `program`)
eto3 <- left_join(eto3_demo_select, eto3_prog_select, by="subjectid")
# All ETO data
eto_data <- rbind(eto2, eto3)
# Merge REDCap data with ETO and Salesforce data
redcap_g2c_raw3 <- left_join(redcap_g2c_raw2, eto_data, by=c("name_first", "name_last"))
redcap_g2c_raw4 <- left_join(redcap_g2c_raw3, salesforce3, by=c("name_first", "name_last"))
redcap_g2c_raw <- unique(redcap_g2c_raw4)
redcap_g2c_raw$gender_merge <- if_else((is.na(redcap_g2c_raw$gender)), redcap_g2c_raw$gender_sales, redcap_g2c_raw$gender)
# Manually replace missing gender and cycle data
redcap_g2c_raw[redcap_g2c_raw$name_last=="Porter" & redcap_g2c_raw$name_first=="Jared","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Johnson" & redcap_g2c_raw$name_first=="Jamyra","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Baker" & redcap_g2c_raw$name_first=="Amori","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","cycle.y"] <- "Cycle 2"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","program"] <- "Civic Works"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Gladney" & redcap_g2c_raw$name_first=="Kayla","gender_merge"] <- "Female"
# Handle cycle
redcap_g2c_raw$cycle1<- ifelse(is.na(redcap_g2c_raw$cycle.y), "Undetermined", redcap_g2c_raw$cycle.y)
```
```{r include=FALSE}
# Import Vanguard data from REDCap project
redcap_labels=read.csv('/Users/jon/Downloads/AssessingAdolescents_DATA_LABELS_2021-08-26_1656.csv')
redcap_raw_van = read.csv('/Users/jon/Downloads/AssessingAdolescents_DATA_2021-08-26_1656.csv')
redcap_van_survey <- filter(redcap_raw_van, redcap_event_name=="youth_arm_1" | redcap_event_name=="youth_arm_2" | redcap_event_name=="youth_arm_3" | redcap_event_name=="youth_arm_4")
redcap_van_survey$arm <- if_else(redcap_van_survey$redcap_event_name=="youth_arm_1", "Youth Arm 1", if_else(redcap_van_survey$redcap_event_name=="youth_arm_2", "Youth Arm 2", if_else(redcap_van_survey$redcap_event_name=="youth_arm_3", "Youth Arm 3", if_else(redcap_van_survey$redcap_event_name=="youth_arm_4", "Youth Arm 4", "NA"))))
```
```{r include=FALSE}
# Food variables for the Vanguard Study only
food_van1 <- dplyr::select(redcap_van_survey, arm, q13a_foodsec, q13b_foodsec, q13c_foodsec, q13d_foodsec, q13e_foodsec, q13f_foodsec, q13g_foodsec, q13h_foodsec, q13i_foodsec)
# Assign labels to choices
food_van1$q13a_foodsec <- if_else(food_van1$q13a_foodsec==2, "A lot", if_else(food_van1$q13a_foodsec==1,"Sometimes", if_else(food_van1$q13a_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13b_foodsec <- if_else(food_van1$q13b_foodsec==2, "A lot", if_else(food_van1$q13b_foodsec==1,"Sometimes", if_else(food_van1$q13b_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13c_foodsec <- if_else(food_van1$q13c_foodsec==2, "A lot", if_else(food_van1$q13c_foodsec==1,"Sometimes", if_else(food_van1$q13c_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13d_foodsec <- if_else(food_van1$q13d_foodsec==2, "A lot", if_else(food_van1$q13d_foodsec==1,"Sometimes", if_else(food_van1$q13d_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13e_foodsec <- if_else(food_van1$q13e_foodsec==2, "A lot", if_else(food_van1$q13e_foodsec==1,"Sometimes", if_else(food_van1$q13e_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13f_foodsec <- if_else(food_van1$q13f_foodsec==2, "A lot", if_else(food_van1$q13f_foodsec==1,"Sometimes", if_else(food_van1$q13f_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13g_foodsec <- if_else(food_van1$q13g_foodsec==2, "A lot", if_else(food_van1$q13g_foodsec==1,"Sometimes", if_else(food_van1$q13g_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13h_foodsec <- if_else(food_van1$q13h_foodsec==2, "A lot", if_else(food_van1$q13h_foodsec==1,"Sometimes", if_else(food_van1$q13h_foodsec==0,"Never", "Prefer not to answer")))
food_van1$q13i_foodsec <- if_else(food_van1$q13i_foodsec==2, "A lot", if_else(food_van1$q13i_foodsec==1,"Sometimes", if_else(food_van1$q13i_foodsec==0,"Never", "Prefer not to answer")))
# Assign variable names
food_van1$"...did you worry that food at home would run out before you/your household got money to buy more?" <-food_van1$q13a_foodsec
food_van1$"...did the food that you/your household bought run out, and you didnt have money to get more?" <- food_van1$q13b_foodsec
food_van1$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"<- food_van1$q13c_foodsec
food_van1$"...were you not able to eat a balanced meal because you/your household didnt have enough money?"<- food_van1$q13d_foodsec
food_van1$"...did you have to eat less because you/your household didnt have enough money to buy food?" <- food_van1$q13e_foodsec
food_van1$"...has the size of your meals been cut because you/your household didnt have enough money for food?"<- food_van1$q13f_foodsec
food_van1$"...did you have to skip a meal because you/your household didnt have enough money for food?"<- food_van1$q13g_foodsec
food_van1$"...were you hungry but didnt eat because you/your household didnt have enough food?"<- food_van1$q13h_foodsec
food_van1$"...did you not eat for a whole day because you/your household didnt have enough money for food?"<- food_van1$q13i_foodsec
# Select only the new variable names
food_van <- dplyr::select(food_van1, arm,
"...did you worry that food at home would run out before you/your household got money to buy more?"
,"...did the food that you/your household bought run out, and you didnt have money to get more?"
,"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"
,"...were you not able to eat a balanced meal because you/your household didnt have enough money?"
,"...did you have to eat less because you/your household didnt have enough money to buy food?"
,"...has the size of your meals been cut because you/your household didnt have enough money for food?"
,"...did you have to skip a meal because you/your household didnt have enough money for food?"
,"...were you hungry but didnt eat because you/your household didnt have enough food?"
,"...did you not eat for a whole day because you/your household didnt have enough money for food?")
# Assign an order to the variables
food_van$"...did you worry that food at home would run out before you/your household got money to buy more?" = factor(food_van$"...did you worry that food at home would run out before you/your household got money to buy more?" , levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...did the food that you/your household bought run out, and you didnt have money to get more?" = factor(food_van$"...did the food that you/your household bought run out, and you didnt have money to get more?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?" = factor(food_van$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...were you not able to eat a balanced meal because you/your household didnt have enough money?" = factor(food_van$"...were you not able to eat a balanced meal because you/your household didnt have enough money?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...did you have to eat less because you/your household didnt have enough money to buy food?" = factor(food_van$"...did you have to eat less because you/your household didnt have enough money to buy food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...has the size of your meals been cut because you/your household didnt have enough money for food?" = factor(food_van$"...has the size of your meals been cut because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...did you have to skip a meal because you/your household didnt have enough money for food?" = factor(food_van$"...did you have to skip a meal because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...were you hungry but didnt eat because you/your household didnt have enough food?" = factor(food_van$"...were you hungry but didnt eat because you/your household didnt have enough food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_van$"...did you not eat for a whole day because you/your household didnt have enough money for food?" = factor(food_van$"...did you not eat for a whole day because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
```
## {.tabset}
### Vanguard graphs
<p><strong>Vanguard Survey – Food Security Questions
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p>
```{r echo=FALSE}
# Vanguard Food Insecurity plot all variables
food_van_likert1 <- likert(food_van[,2:5])
plot(food_van_likert1, wrap=50)
food_van_likert2 <- likert(food_van[,6:10])
plot(food_van_likert2, wrap=50)
```
<p><strong>Vanguard Survey – Food Security Questions, by Youth Arm variable
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p>
```{r echo=FALSE}
# Vanguard food questions, BY CATEGORY
food_van_cat1 <- likert(food_van[,2:4], grouping=food_van$arm)
plot(food_van_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
food_van_cat1 <- likert(food_van[,5:7], grouping=food_van$arm)
plot(food_van_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
food_van_cat1 <- likert(food_van[,8:10], grouping=food_van$arm)
plot(food_van_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
```
### Vanguard Tables
```{r echo=FALSE}
# Table of Vanguard Food Insequrity variables
foodvan_table1 <- food_van1 %>% tabyl(arm, q13a_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table1 <- dplyr::select(foodvan_table1, arm,"NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table2 <- food_van1 %>% tabyl(arm, q13b_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table2 <- dplyr::select(foodvan_table2, arm,"NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table3 <- food_van1 %>% tabyl(arm, q13c_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table3 <- dplyr::select(foodvan_table3, arm, "NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table4 <- food_van1 %>% tabyl(arm, q13d_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table4 <- dplyr::select(foodvan_table4, arm, "NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table5 <- food_van1 %>% tabyl(arm, q13e_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table5 <- dplyr::select(foodvan_table5, arm,"NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table6 <- food_van1 %>% tabyl(arm, q13f_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table6 <- dplyr::select(foodvan_table6, arm,"NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table7 <- food_van1 %>% tabyl(arm, q13g_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table7 <- dplyr::select(foodvan_table7, arm, "NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table8 <- food_van1 %>% tabyl(arm, q13h_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table8 <- dplyr::select(foodvan_table8, arm, "NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodvan_table9 <- food_van1 %>% tabyl(arm, q13i_foodsec) %>% adorn_totals(c("row", "col"))
foodvan_table9 <- dplyr::select(foodvan_table9, arm, "NA_", "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
```
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p></strong>
<br>
<strong>"...did you worry that food at home would run out before you/your household got money to buy more?" </strong>
```{r echo=FALSE}
formattable(foodvan_table1 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did the food that you/your household bought run out, and you didnt have money to get more?" </strong>
```{r echo=FALSE}
formattable(foodvan_table2 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"</strong>
```{r echo=FALSE}
formattable(foodvan_table3 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...were you not able to eat a balanced meal because you/your household didnt have enough money?"</strong>
```{r echo=FALSE}
formattable(foodvan_table4 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you have to eat less because you/your household didnt have enough money to buy food?" </strong>
```{r echo=FALSE}
formattable(foodvan_table5 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...has the size of your meals been cut because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodvan_table6 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you have to skip a meal because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodvan_table7 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...were you hungry but didnt eat because you/your household didnt have enough food?"</strong>
```{r echo=FALSE}
formattable(foodvan_table8 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you not eat for a whole day because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodvan_table9 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
```{r echo=FALSE}
# food for G2C Study only
food_g2c1 <- dplyr::select(redcap_g2c_raw, cycle1, q20a, q20b, q20c, q20d, q20e, q20f, q20g, q20h, q20i)
# Assign labels to choices
food_g2c1$q20a <- if_else(food_g2c1$q20a==2, "A lot", if_else(food_g2c1$q20a==1,"Sometimes", if_else(food_g2c1$q20a==0,"Never", "Prefer not to answer")))
food_g2c1$q20b <- if_else(food_g2c1$q20b==2, "A lot", if_else(food_g2c1$q20b==1,"Sometimes", if_else(food_g2c1$q20b==0,"Never", "Prefer not to answer")))
food_g2c1$q20c <- if_else(food_g2c1$q20c==2, "A lot", if_else(food_g2c1$q20c==1,"Sometimes", if_else(food_g2c1$q20c==0,"Never", "Prefer not to answer")))
food_g2c1$q20d <- if_else(food_g2c1$q20d==2, "A lot", if_else(food_g2c1$q20d==1,"Sometimes", if_else(food_g2c1$q20d==0,"Never", "Prefer not to answer")))
food_g2c1$q20e <- if_else(food_g2c1$q20e==2, "A lot", if_else(food_g2c1$q20e==1,"Sometimes", if_else(food_g2c1$q20e==0,"Never", "Prefer not to answer")))
food_g2c1$q20f <- if_else(food_g2c1$q20f==2, "A lot", if_else(food_g2c1$q20f==1,"Sometimes", if_else(food_g2c1$q20f==0,"Never", "Prefer not to answer")))
food_g2c1$q20g <- if_else(food_g2c1$q20g==2, "A lot", if_else(food_g2c1$q20g==1,"Sometimes", if_else(food_g2c1$q20g==0,"Never", "Prefer not to answer")))
food_g2c1$q20h <- if_else(food_g2c1$q20h==2, "A lot", if_else(food_g2c1$q20h==1,"Sometimes", if_else(food_g2c1$q20h==0,"Never", "Prefer not to answer")))
food_g2c1$q20i <- if_else(food_g2c1$q20i==2, "A lot", if_else(food_g2c1$q20i==1,"Sometimes", if_else(food_g2c1$q20i==0,"Never", "Prefer not to answer")))
# Assign variable names
food_g2c1$"...did you worry that food at home would run out before you/your household got money to buy more?" <-food_g2c1$q20a
food_g2c1$"...did the food that you/your household bought run out, and you didnt have money to get more?" <- food_g2c1$q20b
food_g2c1$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"<- food_g2c1$q20c
food_g2c1$"...were you not able to eat a balanced meal because you/your household didnt have enough money?"<- food_g2c1$q20d
food_g2c1$"...did you have to eat less because you/your household didnt have enough money to buy food?" <- food_g2c1$q20e
food_g2c1$"...has the size of your meals been cut because you/your household didnt have enough money for food?"<- food_g2c1$q20f
food_g2c1$"...did you have to skip a meal because you/your household didnt have enough money for food?"<- food_g2c1$q20g
food_g2c1$"...were you hungry but didnt eat because you/your household didnt have enough food?"<- food_g2c1$q20h
food_g2c1$"...did you not eat for a whole day because you/your household didnt have enough money for food?"<- food_g2c1$q20i
# Select only the new variable names
food_g2c <- dplyr::select(food_g2c1, cycle1,
"...did you worry that food at home would run out before you/your household got money to buy more?"
,"...did the food that you/your household bought run out, and you didnt have money to get more?"
,"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"
,"...were you not able to eat a balanced meal because you/your household didnt have enough money?"
,"...did you have to eat less because you/your household didnt have enough money to buy food?"
,"...has the size of your meals been cut because you/your household didnt have enough money for food?"
,"...did you have to skip a meal because you/your household didnt have enough money for food?"
,"...were you hungry but didnt eat because you/your household didnt have enough food?"
,"...did you not eat for a whole day because you/your household didnt have enough money for food?")
# Assign an order to the variables
food_g2c$"...did you worry that food at home would run out before you/your household got money to buy more?" = factor(food_g2c$"...did you worry that food at home would run out before you/your household got money to buy more?" , levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...did the food that you/your household bought run out, and you didnt have money to get more?" = factor(food_g2c$"...did the food that you/your household bought run out, and you didnt have money to get more?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?" = factor(food_g2c$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...were you not able to eat a balanced meal because you/your household didnt have enough money?" = factor(food_g2c$"...were you not able to eat a balanced meal because you/your household didnt have enough money?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...did you have to eat less because you/your household didnt have enough money to buy food?" = factor(food_g2c$"...did you have to eat less because you/your household didnt have enough money to buy food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...has the size of your meals been cut because you/your household didnt have enough money for food?" = factor(food_g2c$"...has the size of your meals been cut because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...did you have to skip a meal because you/your household didnt have enough money for food?" = factor(food_g2c$"...did you have to skip a meal because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...were you hungry but didnt eat because you/your household didnt have enough food?" = factor(food_g2c$"...were you hungry but didnt eat because you/your household didnt have enough food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
food_g2c$"...did you not eat for a whole day because you/your household didnt have enough money for food?" = factor(food_g2c$"...did you not eat for a whole day because you/your household didnt have enough money for food?", levels = c("Never", "Sometimes", "A lot"), ordered = TRUE)
```
### G2C graphs
<p><strong>G2C Survey – Food Insecurity Questions
<br><stong>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p>
```{r echo=FALSE}
# G2C Food Insecurity plot all variables
food_g2c_likert1 <- likert(food_g2c[,2:5])
plot(food_g2c_likert1, wrap=50)
food_g2c_likert2 <- likert(food_g2c[,6:10])
plot(food_g2c_likert2, wrap=50)
```
<p><strong>G2C Survey – Food Insecurity Questions, <u>by Youth Arm variable</u>
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p>
```{r echo=FALSE}
# G2C food questions, BY CATEGORY
food_g2c_cat1 <- likert(food_g2c[,2:4], grouping=food_g2c$arm)
plot(food_g2c_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
food_g2c_cat1 <- likert(food_g2c[,5:7], grouping=food_g2c$arm)
plot(food_g2c_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
food_g2c_cat1 <- likert(food_g2c[,8:10], grouping=food_g2c$arm)
plot(food_g2c_cat1, wrap=50, col= c("darkseagreen", "azure2", "dodgerblue4"))
```
### G2C Tables
```{r echo=FALSE}
# Table of g2cguard food variables
foodg2c_table1 <- food_g2c1 %>% tabyl(cycle1, q20a) %>% adorn_totals(c("row", "col"))
foodg2c_table1 <- dplyr::select(foodg2c_table1, cycle1,"Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table2 <- food_g2c1 %>% tabyl(cycle1, q20b) %>% adorn_totals(c("row", "col"))
foodg2c_table2 <- dplyr::select(foodg2c_table2, cycle1,"Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table3 <- food_g2c1 %>% tabyl(cycle1, q20c) %>% adorn_totals(c("row", "col"))
foodg2c_table3 <- dplyr::select(foodg2c_table3, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table4 <- food_g2c1 %>% tabyl(cycle1, q20d) %>% adorn_totals(c("row", "col"))
foodg2c_table4 <- dplyr::select(foodg2c_table4, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table5 <- food_g2c1 %>% tabyl(cycle1, q20e) %>% adorn_totals(c("row", "col"))
foodg2c_table5 <- dplyr::select(foodg2c_table5, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table6 <- food_g2c1 %>% tabyl(cycle1, q20f) %>% adorn_totals(c("row", "col"))
foodg2c_table6 <- dplyr::select(foodg2c_table6, cycle1,"Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table7 <- food_g2c1 %>% tabyl(cycle1, q20g) %>% adorn_totals(c("row", "col"))
foodg2c_table7 <- dplyr::select(foodg2c_table7, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table8 <- food_g2c1 %>% tabyl(cycle1, q20h) %>% adorn_totals(c("row", "col"))
foodg2c_table8 <- dplyr::select(foodg2c_table8, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
foodg2c_table9 <- food_g2c1 %>% tabyl(cycle1, q20i) %>% adorn_totals(c("row", "col"))
foodg2c_table9 <- dplyr::select(foodg2c_table9, cycle1, "Prefer not to answer", "Never", "Sometimes", "A lot", Total)
```
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p></strong>
<br>
<strong>"...did you worry that food at home would run out before you/your household got money to buy more?" </strong>
```{r echo=FALSE}
formattable(foodg2c_table1 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did the food that you/your household bought run out, and you didnt have money to get more?" </strong>
```{r echo=FALSE}
formattable(foodg2c_table2 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table3 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...were you not able to eat a balanced meal because you/your household didnt have enough money?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table4 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you have to eat less because you/your household didnt have enough money to buy food?" </strong>
```{r echo=FALSE}
formattable(foodg2c_table5 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...has the size of your meals been cut because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table6 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you have to skip a meal because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table7 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...were you hungry but didnt eat because you/your household didnt have enough food?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table8 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"...did you not eat for a whole day because you/your household didnt have enough money for food?"</strong>
```{r echo=FALSE}
formattable(foodg2c_table9 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
### Vanguard vs. G2C
<br>"The next set of questions will ask you about food in your household.
<br><strong> How often..."</p>
```{r echo=FALSE}
# Merge the vanguard and g2c data for comparison
food_g2c_merge <- dplyr::select(food_g2c, -cycle1)
food_g2c_merge$study <- "Grads2Careers"
food_van_merge <- dplyr::select(food_van, -arm)
food_van_merge$study <- "Vanguard"
food_merged <- rbind(food_g2c_merge,food_van_merge)
food_merged1 <- dplyr::select(food_merged, "...did you worry that food at home would run out before you/your household got money to buy more?"
,"...did the food that you/your household bought run out, and you didnt have money to get more?"
,"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"
,"...were you not able to eat a balanced meal because you/your household didnt have enough money?"
,"...did you have to eat less because you/your household didnt have enough money to buy food?"
,"...has the size of your meals been cut because you/your household didnt have enough money for food?"
,"...did you have to skip a meal because you/your household didnt have enough money for food?"
,"...were you hungry but didnt eat because you/your household didnt have enough food?"
,"...did you not eat for a whole day because you/your household didnt have enough money for food?")
# MERGED food Plot by Study
food_merged_cat1 <- likert(food_merged1[,1:3], grouping=food_merged$study)
plot(food_merged_cat1)
food_merged_cat2 <- likert(food_merged1[,4:6], grouping=food_merged$study)
plot(food_merged_cat2)
food_merged_cat3 <- likert(food_merged1[,7:9], grouping=food_merged$study)
plot(food_merged_cat3)
```
```{r echo=FALSE, message=FALSE, warning=FALSE}
####################### Vanguard ####################
# Select Vanguard food variables and create new variables for total score and dichotomous variable
food_van_total <- dplyr::select(redcap_van_survey, arm, q13a_foodsec, q13b_foodsec, q13c_foodsec, q13d_foodsec, q13e_foodsec, q13f_foodsec, q13g_foodsec, q13h_foodsec, q13i_foodsec)
# Create food Score w/ and w/o "Prefer not to answer"
food_van_total$food_total <- food_van_total$q13a_foodsec + food_van_total$q13b_foodsec + food_van_total$q13c_foodsec + food_van_total$q13d_foodsec + food_van_total$q13e_foodsec + food_van_total$q13f_foodsec + food_van_total$q13g_foodsec + food_van_total$q13h_foodsec + food_van_total$q13i_foodsec
food_van_total$food_total_no_refused <- ifelse(food_van_total$food_total>18, NA, food_van_total$food_total)
# Flagged if score 2 or greater
food_van_total$food_flagged <- if_else(food_van_total$food_total>=2, 1,0)
# Rename Vanguard variables
food_van_total$"...did you worry that food at home would run out before you/your household got money to buy more?" <-food_van_total$q13a_foodsec
food_van_total$"...did the food that you/your household bought run out, and you didnt have money to get more?" <- food_van_total$q13b_foodsec
food_van_total$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"<- food_van_total$q13c_foodsec
food_van_total$"...were you not able to eat a balanced meal because you/your household didnt have enough money?"<- food_van_total$q13d_foodsec
food_van_total$"...did you have to eat less because you/your household didnt have enough money to buy food?" <- food_van_total$q13e_foodsec
food_van_total$"...has the size of your meals been cut because you/your household didnt have enough money for food?"<- food_van_total$q13f_foodsec
food_van_total$"...did you have to skip a meal because you/your household didnt have enough money for food?"<- food_van_total$q13g_foodsec
food_van_total$"...were you hungry but didnt eat because you/your household didnt have enough food?"<- food_van_total$q13h_foodsec
food_van_total$"...did you not eat for a whole day because you/your household didnt have enough money for food?"<- food_van_total$q13i_foodsec
#Select only the new variable names
food_van_totals <- dplyr::select(food_van_total, food_total, food_total_no_refused, food_flagged,
"...did you worry that food at home would run out before you/your household got money to buy more?"
,"...did the food that you/your household bought run out, and you didnt have money to get more?"
,"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"
,"...were you not able to eat a balanced meal because you/your household didnt have enough money?"
,"...did you have to eat less because you/your household didnt have enough money to buy food?"
,"...has the size of your meals been cut because you/your household didnt have enough money for food?"
,"...did you have to skip a meal because you/your household didnt have enough money for food?"
,"...were you hungry but didnt eat because you/your household didnt have enough food?"
,"...did you not eat for a whole day because you/your household didnt have enough money for food?")
######################## G2C #######################
# Add variable names, total and select new variables for G2C data
food_g2c_total <- dplyr::select(redcap_g2c_raw, cycle.y, q20a, q20b, q20c, q20d, q20e, q20f, q20g, q20h, q20i)
# Create a food score w/ and w/o "Prefer not to answer"
food_g2c_total$food_total <- food_g2c_total$q20a + food_g2c_total$q20b + food_g2c_total$q20c + food_g2c_total$q20d + food_g2c_total$q20e + food_g2c_total$q20f + food_g2c_total$q20g + food_g2c_total$q20h + food_g2c_total$q20i
food_g2c_total$food_total_no_refused <- ifelse(food_g2c_total$food_total>18, NA, food_g2c_total$food_total)
# Flagged if score 2 or greater
food_g2c_total$food_flagged <- if_else(food_g2c_total$food_total>=2, 1,0)
# Rename G2C variable
food_g2c_total$"...did you worry that food at home would run out before you/your household got money to buy more?" <-food_g2c_total$q20a
food_g2c_total$"...did the food that you/your household bought run out, and you didnt have money to get more?" <- food_g2c_total$q20b
food_g2c_total$"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"<- food_g2c_total$q20c
food_g2c_total$"...were you not able to eat a balanced meal because you/your household didnt have enough money?"<- food_g2c_total$q20d
food_g2c_total$"...did you have to eat less because you/your household didnt have enough money to buy food?" <- food_g2c_total$q20e
food_g2c_total$"...has the size of your meals been cut because you/your household didnt have enough money for food?"<- food_g2c_total$q20f
food_g2c_total$"...did you have to skip a meal because you/your household didnt have enough money for food?"<- food_g2c_total$q20g
food_g2c_total$"...were you hungry but didnt eat because you/your household didnt have enough food?"<- food_g2c_total$q20h
food_g2c_total$"...did you not eat for a whole day because you/your household didnt have enough money for food?"<- food_g2c_total$q20i
#Select only the new variable names
food_g2c_totals <- dplyr::select(food_g2c_total, food_total, food_total_no_refused, food_flagged, "...did you worry that food at home would run out before you/your household got money to buy more?"
,"...did the food that you/your household bought run out, and you didnt have money to get more?"
,"...did your meals only include a few kinds of cheap foods because you/your household was running out of money to buy food?"
,"...were you not able to eat a balanced meal because you/your household didnt have enough money?"
,"...did you have to eat less because you/your household didnt have enough money to buy food?"
,"...has the size of your meals been cut because you/your household didnt have enough money for food?"
,"...did you have to skip a meal because you/your household didnt have enough money for food?"
,"...were you hungry but didnt eat because you/your household didnt have enough food?"
,"...did you not eat for a whole day because you/your household didnt have enough money for food?")
```
```{r echo=FALSE}
# Combine the studies
food1 <- as.data.frame(ftable(food_van_totals$food_total_no_refused))
food1$Vanguard <- food1$Freq
food_van_totals$study <-"Vanguard"
food2 <- as.data.frame(ftable(food_g2c_totals$food_total_no_refused))
food2$G2C <- food2$Freq
food_g2c_totals$study <- "G2C"
food_total_merged <- rbind(food_g2c_totals, food_van_totals)
```
<strong>Histogram of Food Security Scores (total of 9 variables, range:0-18): Vanguard vs. G2C </strong>
```{r echo=FALSE}
# Create a grouped bar chart
food1$subgroup <- "Vanguard"
food1$group <- food1$Var1
food1$values <- food1$Freq
food1a <- dplyr::select(food1, subgroup, group, values)
food2$subgroup <- "G2c"
food2$group <- food2$Var1
food2$values <- food2$Freq
food2a <- dplyr::select(food2, subgroup, group, values)
food3 <- rbind(food1a, food2a)
ggplot(food3,
aes(x=group,
y=values,
fill=subgroup)) +
geom_bar(position="dodge",
stat="identity")
```
```{r echo=FALSE}
food_total_merged1 <- dplyr::filter(food_total_merged, !is.na(food_total) & food_total <=30)
histogram(~ food_total | study,
main = "Food Security Score, Percent Comparison of Vanguard and G2C",
xlab = "Score",
data=food_total_merged1,
type="percent",
layout=c(1,2)) # columns and rows of individual plots
```
```{r echo=FALSE}
wilcox.test(food_total_merged$food_total_no_refused ~ food_total_merged$study)
t.test(food_total_merged$food_total_no_refused ~ food_total_merged$study)
```
Food Security Score comparison
```{r echo=FALSE}
boxplot(food_total_merged$food_total_no_refused ~ food_total_merged$study, col="#69b3a2" , ylab="Total food Score", xlab = "Study")
```
## 2. Anxiety
```{r message=FALSE, warning=FALSE, include=FALSE}
# ETO data - Cycle 2
eto2_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Demographics")
eto2_demo$subjectid <- eto2_demo$`Subject.Unique.Identifier`
eto2_demo$cycle <- eto2_demo$`Cycle:`
eto2_demo$name_first <- eto2_demo$`First.Name`
eto2_demo$name_last <- eto2_demo$`Last.Name`
eto2_demo$gender <- eto2_demo$`Gender_3753`
eto2_demo$ethnic <- eto2_demo$`Ethnicity-Custom`
eto2_demo$race <- eto2_demo$`Race-Custom`
eto2_demo$dob <- eto2_demo$DOB
eto2_demo$source <- "eto2"
eto2_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Enrolled Current Program")
eto2_prog$subjectid <- eto2_prog$ID
eto2_prog$program <- eto2_prog$`Current.Program`
# ETO data - Cycle 3
eto3_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Demographics")
eto3_demo$subjectid <- eto3_demo$`Subject.Id`
eto3_demo$cycle <- eto3_demo$`Cycle:`
eto3_demo$name_first <- eto3_demo$`First.Name`
eto3_demo$name_last <- eto3_demo$`Last.Name`
eto3_demo$gender <- eto3_demo$`Gender_3753`
eto3_demo$ethnic <- eto3_demo$`Ethnicity-Custom`
eto3_demo$race <- eto3_demo$`Race-Custom`
eto3_demo$dob <- eto3_demo$DOB
eto3_demo$source <- "eto3"
eto3_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Training")
eto3_prog$subjectid <- eto3_prog$SubjectID
eto3_prog$program <- eto3_prog$`Program.Name`
# Salesforce data
salesforce1 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210208 - unlocked.xlsx')
salesforce2 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210209 - unlocked.xlsx')
salesforce2$name_first <- salesforce2$`Contact:.First.Name`
salesforce2$name_last <- salesforce2$`Contact:.Last.Name`
salesforce2$gender_sales <- salesforce2$`Gender`
salesforce2$ethnic_sales <- salesforce2$`Ethnicity`
salesforce2$race_sales <- salesforce2$`Race`
salesforce2$source_sales <- "salesforce"
# Select variables from Salesforce data
salesforce3 <- dplyr::select(salesforce2, name_first, name_last, gender_sales, ethnic_sales, race_sales, source_sales)
# Select variables from ETO data
eto2_demo_select <- dplyr::select(eto2_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto2_prog_select <- dplyr::select(eto2_prog, subjectid, `program`)
eto2 <- left_join(eto2_demo_select, eto2_prog_select, by="subjectid")
eto3_demo_select <- dplyr::select(eto3_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto3_prog_select <- dplyr::select(eto3_prog, subjectid, `program`)
eto3 <- left_join(eto3_demo_select, eto3_prog_select, by="subjectid")
# All ETO data
eto_data <- rbind(eto2, eto3)
# Merge REDCap data with ETO and Salesforce data
redcap_g2c_raw3 <- left_join(redcap_g2c_raw2, eto_data, by=c("name_first", "name_last"))
redcap_g2c_raw4 <- left_join(redcap_g2c_raw3, salesforce3, by=c("name_first", "name_last"))
redcap_g2c_raw <- unique(redcap_g2c_raw4)
redcap_g2c_raw$gender_merge <- if_else((is.na(redcap_g2c_raw$gender)), redcap_g2c_raw$gender_sales, redcap_g2c_raw$gender)
# Manually replace missing gender and cycle data
redcap_g2c_raw[redcap_g2c_raw$name_last=="Porter" & redcap_g2c_raw$name_first=="Jared","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Johnson" & redcap_g2c_raw$name_first=="Jamyra","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Baker" & redcap_g2c_raw$name_first=="Amori","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","cycle.y"] <- "Cycle 2"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","program"] <- "Civic Works"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Gladney" & redcap_g2c_raw$name_first=="Kayla","gender_merge"] <- "Female"
# Handle cycle
redcap_g2c_raw$cycle1<- ifelse(is.na(redcap_g2c_raw$cycle.y), "Undetermined", redcap_g2c_raw$cycle.y)
```
```{r include=FALSE}
# Import Vanguard data from REDCap project
redcap_van_survey <- filter(redcap_raw_van, redcap_event_name=="youth_arm_1" | redcap_event_name=="youth_arm_2" | redcap_event_name=="youth_arm_3" | redcap_event_name=="youth_arm_4")
redcap_van_survey$arm1 <- if_else(redcap_van_survey$redcap_event_name=="youth_arm_1", "Youth Arm 1", if_else(redcap_van_survey$redcap_event_name=="youth_arm_2", "Youth Arm 2", if_else(redcap_van_survey$redcap_event_name=="youth_arm_3", "Youth Arm 3", if_else(redcap_van_survey$redcap_event_name=="youth_arm_4", "Youth Arm 4", "NA"))))
redcap_van_survey$arm<- ifelse(is.na(redcap_van_survey$arm1), "NA", redcap_van_survey$arm1)
```
```{r include=FALSE}
# Anxiety for Vanguard Study only
anxiety_van1 <- dplyr::select(redcap_van_survey, arm, q22a_anxiety, q22b_anxiety, q22c_anxiety, q22d_anxiety)
# Assign labels to choices
anxiety_van1$q22a_anxiety <- if_else(anxiety_van1$q22a_anxiety==4, "Almost always", if_else(anxiety_van1$q22a_anxiety==3,"Often", if_else(anxiety_van1$q22a_anxiety==2,"Sometimes",
if_else(anxiety_van1$q22a_anxiety==1,"Almost never", if_else(anxiety_van1$q22a_anxiety==0,"Never", "Prefer not to answer")))))
anxiety_van1$q22b_anxiety <- if_else(anxiety_van1$q22b_anxiety==4, "Almost always", if_else(anxiety_van1$q22b_anxiety==3,"Often", if_else(anxiety_van1$q22b_anxiety==2,"Sometimes",
if_else(anxiety_van1$q22b_anxiety==1,"Almost never", if_else(anxiety_van1$q22b_anxiety==0,"Never", "Prefer not to answer")))))
anxiety_van1$q22c_anxiety <- if_else(anxiety_van1$q22c_anxiety==4, "Almost always", if_else(anxiety_van1$q22c_anxiety==3,"Often", if_else(anxiety_van1$q22c_anxiety==2,"Sometimes",
if_else(anxiety_van1$q22c_anxiety==1,"Almost never", if_else(anxiety_van1$q22c_anxiety==0,"Never", "Prefer not to answer")))))
anxiety_van1$q22d_anxiety <- if_else(anxiety_van1$q22d_anxiety==4, "Almost always", if_else(anxiety_van1$q22d_anxiety==3,"Often", if_else(anxiety_van1$q22d_anxiety==2,"Sometimes",
if_else(anxiety_van1$q22d_anxiety==1,"Almost never", if_else(anxiety_van1$q22d_anxiety==0,"Never", "Prefer not to answer")))))
#Assign variable names
anxiety_van1$"I felt like something awful might happen"<- anxiety_van1$q22a_anxiety
anxiety_van1$"I felt nervous"<- anxiety_van1$q22b_anxiety
anxiety_van1$"I felt worried"<- anxiety_van1$q22c_anxiety
anxiety_van1$"I worried when I was at home" <- anxiety_van1$q22d_anxiety
#Select only the new variable names
anxiety_van <- dplyr::select(anxiety_van1, arm,"I felt like something awful might happen","I felt nervous","I felt worried","I worried when I was at home")
#Assign an order to the variables
anxiety_van$"I felt like something awful might happen" = factor(anxiety_van$"I felt like something awful might happen", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_van$"I felt nervous" = factor(anxiety_van$"I felt nervous", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_van$"I felt worried" = factor(anxiety_van$"I felt worried", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_van$"I worried when I was at home" = factor(anxiety_van$"I worried when I was at home", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
```
## {.tabset}
### Vanguard graphs
<p><strong>Vanguard Survey – Anxiety Questions
<br>"Please answer the following questions based on how you felt in the past 7 days."</p>
```{r echo=FALSE}
# Vanguard anxiety Plot all variables
anxiety_van_likert <- likert(anxiety_van[,2:5])
plot(anxiety_van_likert, wrap=25)
```
<p><strong>Vanguard Survey – Anxiety Questions, by Youth Arm variable
<br>"Please answer the following questions based on how you felt in the past 7 days."</p>
```{r echo=FALSE}
# Vanguard anxiety questions, BY CATEGORY
anxiety_van_cat1 <- likert(anxiety_van[,2:5], grouping=anxiety_van$arm)
plot(anxiety_van_cat1, wrap=50)
```
### Vanguard Tables
```{r echo=FALSE}
# Table of Vanguard anxiety variables
anxietyvan_table1 <- anxiety_van1 %>% tabyl(arm, q22a_anxiety) %>% adorn_totals(c("row", "col"))
anxietyvan_table1 <- dplyr::select(anxietyvan_table1, arm,"NA_", "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyvan_table2 <- anxiety_van1 %>% tabyl(arm, q22b_anxiety) %>% adorn_totals(c("row", "col"))
anxietyvan_table2 <- dplyr::select(anxietyvan_table2, arm,"NA_", "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyvan_table3 <- anxiety_van1 %>% tabyl(arm, q22c_anxiety) %>% adorn_totals(c("row", "col"))
anxietyvan_table3 <- dplyr::select(anxietyvan_table3, arm, "NA_","Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyvan_table4 <- anxiety_van1 %>% tabyl(arm, q22d_anxiety) %>% adorn_totals(c("row", "col"))
anxietyvan_table4 <- dplyr::select(anxietyvan_table4, arm, "NA_","Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
```
<strong>"I felt like something awful might happen" </strong>
```{r echo=FALSE}
formattable(anxietyvan_table1 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I felt nervous"</strong>
```{r echo=FALSE}
formattable(anxietyvan_table2 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I felt worried"</strong>
```{r echo=FALSE}
formattable(anxietyvan_table3 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I worried when I was at home"</strong>
```{r echo=FALSE}
formattable(anxietyvan_table4 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
```{r echo=FALSE}
# Anxiety for G2C Study only
anxiety_g2c1 <- dplyr::select(redcap_g2c_raw, cycle1, q34a, q34b, q34c, q34d)
# Assign labels to choices
anxiety_g2c1$q34a <- if_else(anxiety_g2c1$q34a==4, "Almost always", if_else(anxiety_g2c1$q34a==3,"Often", if_else(anxiety_g2c1$q34a==2,"Sometimes",
if_else(anxiety_g2c1$q34a==1,"Almost never", if_else(anxiety_g2c1$q34a==0,"Never", "Prefer not to answer")))))
anxiety_g2c1$q34b<- if_else(anxiety_g2c1$q34b==4, "Almost always", if_else(anxiety_g2c1$q34b==3,"Often", if_else(anxiety_g2c1$q34b==2,"Sometimes",
if_else(anxiety_g2c1$q34b==1,"Almost never", if_else(anxiety_g2c1$q34b==0,"Never", "Prefer not to answer")))))
anxiety_g2c1$q34c <- if_else(anxiety_g2c1$q34c==4, "Almost always", if_else(anxiety_g2c1$q34c==3,"Often", if_else(anxiety_g2c1$q34c==2,"Sometimes",
if_else(anxiety_g2c1$q34c==1,"Almost never", if_else(anxiety_g2c1$q34c==0,"Never", "Prefer not to answer")))))
anxiety_g2c1$q34d <- if_else(anxiety_g2c1$q34d==4, "Almost always", if_else(anxiety_g2c1$q34d==3,"Often", if_else(anxiety_g2c1$q34d==2,"Sometimes",
if_else(anxiety_g2c1$q34d==1,"Almost never", if_else(anxiety_g2c1$q34d==0,"Never", "Prefer not to answer")))))
# Assign variable names
anxiety_g2c1$"I felt like something awful might happen"<- anxiety_g2c1$q34a
anxiety_g2c1$"I felt nervous"<- anxiety_g2c1$q34b
anxiety_g2c1$"I felt worried"<- anxiety_g2c1$q34c
anxiety_g2c1$"I worried when I was at home"<- anxiety_g2c1$q34d
# Select only the new variable names
anxiety_g2c <- dplyr::select(anxiety_g2c1, cycle1,
"I felt like something awful might happen"
,"I felt nervous"
,"I felt worried"
,"I worried when I was at home")
anxiety_g2c$"I felt like something awful might happen"= factor(anxiety_g2c$"I felt like something awful might happen", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_g2c$"I felt nervous"= factor(anxiety_g2c$"I felt nervous", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_g2c$"I felt worried"= factor(anxiety_g2c$"I felt worried", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
anxiety_g2c$"I worried when I was at home"= factor(anxiety_g2c$"I worried when I was at home", levels = c("Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always"), ordered = TRUE)
```
### G2C graphs
<strong>"Please answer the following questions based on how you felt in the past 7 days."/strong>
```{r echo=FALSE}
# G2c anxiety Plot all variables
anxiety_g2c_likert <- likert(anxiety_g2c[,2:5])
plot(anxiety_g2c_likert, wrap=30, order=F)
```
<p><strong>G2C Survey – Anxiety Questions, by Youth Arm variable
<br>"Please answer the following questions based on how you felt in the past 7 days."</strong></p>
```{r echo=FALSE}
# G2C anxiety questions, BY CATEGORY
anxiety_g2c_cat1 <- likert(anxiety_g2c[,2:5], grouping=anxiety_g2c$cycle1)
plot(anxiety_g2c_cat1, wrap=30)
```
### G2C Tables
```{r echo=FALSE}
# Table of g2cguard anxiety variables
anxietyg2c_table1 <- anxiety_g2c1 %>% tabyl(cycle1, q34a) %>% adorn_totals(c("row", "col"))
anxietyg2c_table1 <- dplyr::select(anxietyg2c_table1, cycle1, "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyg2c_table2 <- anxiety_g2c1 %>% tabyl(cycle1, q34b) %>% adorn_totals(c("row", "col"))
anxietyg2c_table2 <- dplyr::select(anxietyg2c_table2, cycle1, "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyg2c_table3 <- anxiety_g2c1 %>% tabyl(cycle1, q34c) %>% adorn_totals(c("row", "col"))
anxietyg2c_table3 <- dplyr::select(anxietyg2c_table3, cycle1, "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
anxietyg2c_table4 <- anxiety_g2c1 %>% tabyl(cycle1, q34d) %>% adorn_totals(c("row", "col"))
anxietyg2c_table4 <- dplyr::select(anxietyg2c_table4, cycle1, "Prefer not to answer", "Never", "Almost never", "Sometimes", "Often", "Almost always", Total)
```
<strong>"I felt like something awful might happen"</strong>
```{r echo=FALSE}
formattable(anxietyg2c_table1 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I felt nervous" </strong>
```{r echo=FALSE}
formattable(anxietyg2c_table2 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I felt worried"</strong>
```{r echo=FALSE}
formattable(anxietyg2c_table3 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
<strong>"I worried when I was at home" </strong>
```{r echo=FALSE}
formattable(anxietyg2c_table4 %>% adorn_percentages("row") %>% adorn_pct_formatting(digits = 1))
```
### Vanguard vs. G2C
<strong>Please answer the following questions based on how you felt in the past 7 days.</strong>
```{r echo=FALSE}
# Merge the vanguard and g2c data for comparison
anxiety_g2c_merge <- dplyr::select(anxiety_g2c, -cycle1)
anxiety_g2c_merge$study <- "Grads2Careers"
anxiety_van_merge <- dplyr::select(anxiety_van, -arm)
anxiety_van_merge$study <- "Vanguard"
anxiety_merged <- rbind(anxiety_g2c_merge,anxiety_van_merge)
anxiety_merged1 <- dplyr::select(anxiety_merged, "I felt like something awful might happen","I felt nervous","I felt worried","I worried when I was at home")
# MERGED anxiety Plot by Study
anxiety_merged_cat1 <- likert(anxiety_merged1, grouping=anxiety_merged$study)
plot(anxiety_merged_cat1)
```
```{r echo=FALSE, message=FALSE, warning=FALSE}
####################### Vanguard ####################
# Select Vanguard anxiety variables and create new variables for total score and dichotomous variable
anxiety_van_total <- dplyr::select(redcap_van_survey, arm, q22a_anxiety, q22b_anxiety, q22c_anxiety, q22d_anxiety)
# Create Anxiety Score w/ and w/o "Prefer not to answer"
anxiety_van_total$anxiety_total <- anxiety_van_total$q22a_anxiety + anxiety_van_total$q22b_anxiety + anxiety_van_total$q22c_anxiety + anxiety_van_total$q22d_anxiety
anxiety_van_total$anxiety_total_no_refused <- ifelse(anxiety_van_total$anxiety_total>16, NA, anxiety_van_total$anxiety_total)
# Flagged if score 8 or greater
anxiety_van_total$anxiety_flagged <- if_else(anxiety_van_total$anxiety_total>=8, 1,0)
# Rename Vanguard variables
anxiety_van_total$"I felt like something awful might happen" <- anxiety_van_total$q22a_anxiety
anxiety_van_total$"I felt nervous" <- anxiety_van_total$q22b_anxiety
anxiety_van_total$"I felt worried" <- anxiety_van_total$q22c_anxiety
anxiety_van_total$"I worried when I was at home" <- anxiety_van_total$q22d_anxiety
#Select only the new variable names
anxiety_van_totals <- dplyr::select(anxiety_van_total, anxiety_total, anxiety_total_no_refused, anxiety_flagged,
"I felt like something awful might happen","I felt nervous","I felt worried"
,"I worried when I was at home")
######################## G2C #######################
# Add variable names, total and select new variables for G2C data
anxiety_g2c_total <- dplyr::select(redcap_g2c_raw, cycle.y, q34a, q34b, q34c, q34d)
# Create a anxiety score w/ and w/o "Prefer not to answer"
anxiety_g2c_total$anxiety_total <- anxiety_g2c_total$q34a + anxiety_g2c_total$q34b + anxiety_g2c_total$q34c + anxiety_g2c_total$q34d
anxiety_g2c_total$anxiety_total_no_refused <- ifelse(anxiety_g2c_total$anxiety_total>16, NA, anxiety_g2c_total$anxiety_total)
# Flagged if score 8 or greater
anxiety_g2c_total$anxiety_flagged <- if_else(anxiety_g2c_total$anxiety_total>=8, 1,0)
# Rename G2C variable
anxiety_g2c_total$"I felt like something awful might happen" <- anxiety_g2c_total$q34a
anxiety_g2c_total$"I felt nervous" <- anxiety_g2c_total$q34b
anxiety_g2c_total$"I felt worried"<- anxiety_g2c_total$q34c
anxiety_g2c_total$"I worried when I was at home"<- anxiety_g2c_total$q34d
#Select only the new variable names
anxiety_g2c_totals <- dplyr::select(anxiety_g2c_total, anxiety_total, anxiety_total_no_refused, anxiety_flagged,"I felt like something awful might happen", "I felt nervous","I felt worried","I worried when I was at home")
```
```{r echo=FALSE}
# Combine the studies
anxiety1 <- as.data.frame(ftable(anxiety_van_totals$anxiety_total_no_refused))
anxiety1$Vanguard <- anxiety1$Freq
anxiety_van_totals$study <-"Vanguard"
anxiety2 <- as.data.frame(ftable(anxiety_g2c_totals$anxiety_total_no_refused))
anxiety2$G2C <- anxiety2$Freq
anxiety_g2c_totals$study <- "G2C"
anxiety_total_merged <- rbind(anxiety_g2c_totals, anxiety_van_totals)
```
<strong>Histogram of anxiety Scores (total of 4 variables, range:0-16): Vanguard vs. G2C </strong>
```{r echo=FALSE}
# Create a grouped bar chart
anxiety1$subgroup <- "Vanguard"
anxiety1$group <- anxiety1$Var1
anxiety1$values <- anxiety1$Freq
anxiety1a <- dplyr::select(anxiety1, subgroup, group, values)
anxiety2$subgroup <- "G2c"
anxiety2$group <- anxiety2$Var1
anxiety2$values <- anxiety2$Freq
anxiety2a <- dplyr::select(anxiety2, subgroup, group, values)
anxiety3 <- rbind(anxiety1a, anxiety2a)
ggplot(anxiety3,
aes(x=group,
y=values,
fill=subgroup)) +
geom_bar(position="dodge",
stat="identity")
```
```{r echo=FALSE}
anxiety_total_merged1 <- dplyr::filter(anxiety_total_merged, !is.na(anxiety_total) & anxiety_total <=30)
histogram(~ anxiety_total | study,
main = "Anxiety Score, Percent Comparison of Vanguard and G2C",
xlab = "Score",
data=anxiety_total_merged1,
type="percent",
layout=c(1,2)) # columns and rows of individual plots
```
```{r echo=FALSE}
wilcox.test(anxiety_total_merged$anxiety_total_no_refused ~ anxiety_total_merged$study)
t.test(anxiety_total_merged$anxiety_total_no_refused ~ anxiety_total_merged$study)
```
Anxiety Score comparison
```{r echo=FALSE}
boxplot(anxiety_total_merged$anxiety_total_no_refused ~ anxiety_total_merged$study, col="#69b3a2" , ylab="Total anxiety Score", xlab = "Study")
```
## 3. PTSD / Trauma
```{r message=FALSE, warning=FALSE, include=FALSE}
# Import G2C REDCap data for comparison to Vanguard
redcap_g2c_raw2 = filter(redcap_g2c_raw1, heybmore_survey_complete==2)
redcap_g2c_raw2$name_first <- redcap_g2c_raw2$info_fn
redcap_g2c_raw2$name_last <- redcap_g2c_raw2$info_ln
redcap_g2c_raw2$dob <- redcap_g2c_raw2$dob
# ETO data - Cycle 2
eto2_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Demographics")
eto2_demo$subjectid <- eto2_demo$`Subject.Unique.Identifier`
eto2_demo$cycle <- eto2_demo$`Cycle:`
eto2_demo$name_first <- eto2_demo$`First.Name`
eto2_demo$name_last <- eto2_demo$`Last.Name`
eto2_demo$gender <- eto2_demo$`Gender_3753`
eto2_demo$ethnic <- eto2_demo$`Ethnicity-Custom`
eto2_demo$race <- eto2_demo$`Race-Custom`
eto2_demo$dob <- eto2_demo$DOB
eto2_demo$source <- "eto2"
eto2_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHU_Request022021_Demographics(cycle 2).xlsx', sheet="Enrolled Current Program")
eto2_prog$subjectid <- eto2_prog$ID
eto2_prog$program <- eto2_prog$`Current.Program`
# ETO data - Cycle 3
eto3_demo = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Demographics")
eto3_demo$subjectid <- eto3_demo$`Subject.Id`
eto3_demo$cycle <- eto3_demo$`Cycle:`
eto3_demo$name_first <- eto3_demo$`First.Name`
eto3_demo$name_last <- eto3_demo$`Last.Name`
eto3_demo$gender <- eto3_demo$`Gender_3753`
eto3_demo$ethnic <- eto3_demo$`Ethnicity-Custom`
eto3_demo$race <- eto3_demo$`Race-Custom`
eto3_demo$dob <- eto3_demo$DOB
eto3_demo$source <- "eto3"
eto3_prog = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/ETO Data/JHURequest022021_Cycle3.xlsx', sheet="Training")
eto3_prog$subjectid <- eto3_prog$SubjectID
eto3_prog$program <- eto3_prog$`Program.Name`
# Salesforce data
salesforce1 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210208 - unlocked.xlsx')
salesforce2 = read.xlsx('/Users/jon/Desktop/PFRH/Grads2Careers - HEYBMORE/Data/Salesforce data/Salesforce Data for JHU 210209 - unlocked.xlsx')
salesforce2$name_first <- salesforce2$`Contact:.First.Name`
salesforce2$name_last <- salesforce2$`Contact:.Last.Name`
salesforce2$gender_sales <- salesforce2$`Gender`
salesforce2$ethnic_sales <- salesforce2$`Ethnicity`
salesforce2$race_sales <- salesforce2$`Race`
salesforce2$source_sales <- "salesforce"
# Select variables from Salesforce data
salesforce3 <- dplyr::select(salesforce2, name_first, name_last, gender_sales, ethnic_sales, race_sales, source_sales)
# Select variables from ETO data
eto2_demo_select <- dplyr::select(eto2_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto2_prog_select <- dplyr::select(eto2_prog, subjectid, `program`)
eto2 <- left_join(eto2_demo_select, eto2_prog_select, by="subjectid")
eto3_demo_select <- dplyr::select(eto3_demo, subjectid, cycle, name_first, name_last, gender, ethnic, race, dob, source)
eto3_prog_select <- dplyr::select(eto3_prog, subjectid, `program`)
eto3 <- left_join(eto3_demo_select, eto3_prog_select, by="subjectid")
# All ETO data
eto_data <- rbind(eto2, eto3)
# Merge REDCap data with ETO and Salesforce data
redcap_g2c_raw3 <- left_join(redcap_g2c_raw2, eto_data, by=c("name_first", "name_last"))
redcap_g2c_raw4 <- left_join(redcap_g2c_raw3, salesforce3, by=c("name_first", "name_last"))
redcap_g2c_raw <- unique(redcap_g2c_raw4)
redcap_g2c_raw$gender_merge <- if_else((is.na(redcap_g2c_raw$gender)), redcap_g2c_raw$gender_sales, redcap_g2c_raw$gender)
# Manually replace missing gender and cycle data
redcap_g2c_raw[redcap_g2c_raw$name_last=="Porter" & redcap_g2c_raw$name_first=="Jared","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Christian" & redcap_g2c_raw$name_first=="Ja'Daia","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Johnson" & redcap_g2c_raw$name_first=="Jamyra","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Baker" & redcap_g2c_raw$name_first=="Amori","gender_merge"] <- "Female"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","cycle.y"] <- "Cycle 2"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Collins" & redcap_g2c_raw$name_first=="Jatay","program"] <- "Civic Works"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","gender_merge"] <- "Male"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Evans" & redcap_g2c_raw$name_first=="Dasean","cycle.y"] <- "Cycle 3"
redcap_g2c_raw[redcap_g2c_raw$name_last=="Gladney" & redcap_g2c_raw$name_first=="Kayla","gender_merge"] <- "Female"
# Handle cycle
redcap_g2c_raw$cycle1<- ifelse(is.na(redcap_g2c_raw$cycle.y), "Undetermined", redcap_g2c_raw$cycle.y)
```
```{r include=FALSE}
# Import Vanguard data from REDCap project
redcap_van_survey <- filter(redcap_raw_van, redcap_event_name=="youth_arm_1" | redcap_event_name=="youth_arm_2" | redcap_event_name=="youth_arm_3" | redcap_event_name=="youth_arm_4")
redcap_van_survey$arm <- if_else(redcap_van_survey$redcap_event_name=="youth_arm_1", "Youth Arm 1", if_else(redcap_van_survey$redcap_event_name=="youth_arm_2", "Youth Arm 2", if_else(redcap_van_survey$redcap_event_name=="youth_arm_3", "Youth Arm 3", if_else(redcap_van_survey$redcap_event_name=="youth_arm_4", "Youth Arm 4", "NA"))))
```
```{r include=FALSE}
# ptsd for Vanguard Study only
ptsd_van1 <- dplyr::select(redcap_van_survey, arm, q23a_trauma, q23b_trauma, q23c_trauma, q23d_trauma)
# Assign labels to choices
ptsd_van1$q23a_trauma <- if_else(ptsd_van1$q23a_trauma==4, "Etremely", if_else(ptsd_van1$q23a_trauma==3,"Quite a bit", if_else(ptsd_van1$q23a_trauma==2,"Moderately",
if_else(ptsd_van1$q23a_trauma==1,"A little bit", if_else(ptsd_van1$q23a_trauma==0,"Not at all", "Prefer not to answer")))))
ptsd_van1$q23b_trauma <- if_else(ptsd_van1$q23b_trauma==4, "Etremely", if_else(ptsd_van1$q23b_trauma==3,"Quite a bit", if_else(ptsd_van1$q23b_trauma==2,"Moderately",
if_else(ptsd_van1$q23b_trauma==1,"A little bit", if_else(ptsd_van1$q23b_trauma==0,"Not at all", "Prefer not to answer")))))
ptsd_van1$q23c_trauma <- if_else(ptsd_van1$q23c_trauma==4, "Etremely", if_else(ptsd_van1$q23c_trauma==3,"Quite a bit", if_else(ptsd_van1$q23c_trauma==2,"Moderately",
if_else(ptsd_van1$q23c_trauma==1,"A little bit", if_else(ptsd_van1$q23c_trauma==0,"Not at all", "Prefer not to answer")))))
ptsd_van1$q23d_trauma <- if_else(ptsd_van1$q23d_trauma==4, "Etremely", if_else(ptsd_van1$q23d_trauma==3,"Quite a bit", if_else(ptsd_van1$q23d_trauma==2,"Moderately",
if_else(ptsd_van1$q23d_trauma==1,"A little bit", if_else(ptsd_van1$q23d_trauma==0,"Not at all", "Prefer not to answer")))))
#Assign variable names
ptsd_van1$"Suddenly feeling or acting as if the stressful experience were actually happening again"<- ptsd_van1$q23a_trauma
ptsd_van1$"Avoiding external reminders of the stressful experience"<- ptsd_van1$q23b_trauma
ptsd_van1$"Feeling distant or cut off from other people"<- ptsd_van1$q23c_trauma
ptsd_van1$"Irritable behavior, angry outbursts, or acting aggressively" <- ptsd_van1$q23d_trauma
#Select only the new variable names
ptsd_van <- dplyr::select(ptsd_van1, arm, "Suddenly feeling or acting as if the stressful experience were actually happening again"
,"Avoiding external reminders of the stressful experience"
,"Feeling distant or cut off from other people"
,"Irritable behavior, angry outbursts, or acting aggressively")
#Assign an order to the variables
ptsd_van$"Suddenly feeling or acting as if the stressful experience were actually happening again" = factor(ptsd_van$"Suddenly feeling or acting as if the stressful experience were actually happening again", levels = c("Prefer not to answer", "Not at all", "A little bit", "Moderately", "Quite a bit", "Etremely"), ordered = TRUE)
ptsd_van$"Avoiding external reminders of the stressful experience" = factor(ptsd_van$"Avoiding external reminders of the stressful experience", levels = c("Prefer not to answer", "Not at all", "A little bit", "Moderately", "Quite a bit", "Etremely"), ordered = TRUE)
ptsd_van$"Feeling distant or cut off from other people" = factor(ptsd_van$"Feeling distant or cut off from other people", levels = c("Prefer not to answer", "Not at all", "A little bit", "Moderately", "Quite a bit", "Etremely"), ordered = TRUE)
ptsd_van$"Irritable behavior, angry outbursts, or acting aggressively" = factor(ptsd_van$"Irritable behavior, angry outbursts, or acting aggressively", levels = c("Prefer not to answer", "Not at all", "A little bit", "Moderately", "Quite a bit", "Etremely"), ordered = TRUE)
```
## {.tabset}
### Vanguard graphs
<p><strong>Vanguard Survey – PTSD Questions
<br>"Below is a list of problems that people sometimes have in response to a very stressful experience. Please read each problem carefully and then circle one of the numbers to the right to indicate how much you have been bothered by that problem in the <u>past 30 days</u>.
In the <u>past 30 days</u>, how much were you bothered by:"</p>
```{r echo=FALSE}
# Vanguard PTSD Plot all variables
ptsd_van_likert <- likert(ptsd_van[,2:5])
plot(ptsd_van_likert, wrap=25)
```
<p><strong>Vanguard Survey – PTSD Questions, by Youth Arm variable
<br>"Below is a list of problems that people sometimes have in response to a very stressful experience. Please read each problem carefully and then circle one of the numbers to the right to indicate how much you have been bothered by that problem in the <u>past 30 days</u>.
In the <u>past 30 days</u>, how much were you bothered by:"</p>
```{r echo=FALSE}
# Vanguard ptsd questions, BY CATEGORY
ptsd_van_cat1 <- likert(ptsd_van[,2:5], grouping=ptsd_van$arm)