-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurvey_analysis.Rmd
2195 lines (1972 loc) · 95.3 KB
/
survey_analysis.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: "survey_analysis"
author: "Michael Breshock"
date: "6/18/2021"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
library(tidyverse)
library(googlesheets4)
library(openxlsx)
library(magrittr)
library(ggpubr)
library(forcats)
```
*note: if time, consider remaking plots with ggpubr theme*
### Read in google form survey responses sheet:
```{r}
survey = read_sheet("https://docs.google.com/spreadsheets/d/10OBdqdZKAsXzamg-IQvlIzyGd0cS2kF-xBAKXJ0yFl0/edit#gid=385855959")
```
### removing first two empty rows and filtering for only respondents that consented
```{r}
responses = survey[-1:-2,]
# renaming a couple global columns
consented = responses %>% rename(consent = `Do you consent to your responses being used for research purposes? Please see the description at the beginning of the survey for more information (use the back button within this survey if you wish to see it again).`) %>% rename(responder_category = `How would you describe yourself (choose best option)? Note that you can say "wish not to say" for the "other" category.`) %>%
filter(consent == "Yes") %>% rename(date = Timestamp)
# cleaning up responses
consented %<>% mutate(responder_category = str_replace(responder_category, "Data analyst - using data science in the corporate world", "Self-learner") %>% str_extract(paste(c("Student","Educator","Self-learner"), collapse="|")))
# saving attribute label (original survey question)
attr(consented$date, "label") = "The date when the responder submitted the survey."
attr(consented$responder_category, "label") = 'How would you describe yourself (choose best option)? Note that you can say "wish not to say" for the "other" category.'
attr(consented$consent, "label") = "Do you consent to your responses being used for research purposes? Please see the description at the beginning of the survey for more information (use the back button within this survey if you wish to see it again)."
# split into 3 objects based on responder class (student,educator,self-learner)
# remove columns that are all NA
# possibly transpose - depends which looks best
```
### splitting data table into different respondent types and removing columns that are all NA values
```{r}
student = filter(consented, responder_category == "Student")
student = student[,colSums(is.na(student))<nrow(student)]
educator = filter(consented, responder_category == "Educator")
educator = educator[,colSums(is.na(educator))<nrow(educator)]
self_learner = filter(consented, responder_category == "Self-learner")
self_learner = self_learner[,colSums(is.na(self_learner))<nrow(self_learner)]
# other = filter(consented, !(responder_category %in% c("Student - using case studies for a course or to help with a course", "Educator of Data Science/Stats/Public Health/other - looking for data and education material to use in courses", "Self-learner - interested in learning more about the skills, topics, and or concepts covered in the case studies")))
# other = other[,colSums(is.na(other))<nrow(other)]
```
use stringr to remove unneccessary info in responses
ex: change responses to just Student, Educator, Self-learner etc -> str_extract
ex: remove "interested in" from "interested in statistics etc" responses -> str_remove
case_when() also helpful (from dplyr)
see diet case study for help
look into making codebook
see slack
https://www.alexcernat.com/easy-way-to-make-a-codebook-in-r/
## Wrangling
### changing column/variable names, saving old name (the question posed in survey) as attribute label, shortening answers
educator:
```{r educatordf}
educatordf = educator %>%
rename(future_teach =
`Are you interested in using our case study materials or the data from one of our case studies to teach in the future?`)
attr(educatordf$future_teach, "label") =
"Are you interested in using our case study materials or the data from one of our case studies to teach in the future?"
educatordf = educatordf %>%
rename(feedback1 =
`Please provide any additional feedback you might have....5`)
attr(educatordf$feedback1, "label") =
"Please provide any additional feedback you might have....5"
educatordf = educatordf %>%
rename(recommend =
`How likely are you to recommend the case studies to others?...25`)
attr(educatordf$recommend, "label") =
"How likely are you to recommend the case studies to others?...25"
educatordf = educatordf %>%
rename(teaching_interests =
`What specifically brought you to the case studies? (select all that apply)...26`)
educatordf %<>% mutate(teaching_interests = str_extract_all(teaching_interests,
paste(c("statistics", "specific statistical topic",
"data science", "specific data science skill",
"R programming", "tidyverse", "public health",
"specific public health topic"), collapse="|")))
attr(educatordf$teaching_interests, "label") =
"What specifically brought you to the case studies? (select all that apply)...26"
attr(educatordf$teaching_interests, "values") =
list("statistics" = "General interest in teaching material about statistics",
"specific statistical topic" =
"Interested in teaching about a specific statistical topic (paired t-test, regression, etc.)",
"data science" = "General interest in teaching materials about data science/data analysis",
"specific data science skill" =
"Interested in teaching about a specific data science skill (such as creating a dashboard)",
"R programming" = "General interest in teaching materials about R programming",
"tidyverse" = "General interest in teaching materials about the tidyverse",
"public health" = "General interest in teaching materials about public health",
"specific public health topic" =
"Interested in teaching about a specific public health topic (such as mental health, obesity etc.)"
)
# seperating teaching_interests into boolean columns
educatordf %<>%
mutate(
teach_stats = case_when(
grepl("statistics", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_spfc_stats = case_when(
grepl("specific statistical topic", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_ds = case_when(
grepl('"data science"', teaching_interests) == TRUE ~ "1",
grepl("data science$", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_spfc_ds = case_when(
grepl("specific data science skill", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_R = case_when(
grepl("R programming", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_tidyverse = case_when(
grepl("tidyverse", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_PH = case_when(
grepl('"public health"', teaching_interests) == TRUE ~ "1",
grepl("public health$", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0"),
teach_spfc_PH = case_when(
grepl("specific public health topic", teaching_interests) == TRUE ~ "1",
is.na(teaching_interests) ~ "NA",
TRUE ~ "0")
) %>% relocate(teach_stats, teach_spfc_stats, teach_ds, teach_spfc_ds,
teach_R, teach_tidyverse, teach_PH, teach_spfc_PH,
.after = teaching_interests)
educatordf = educatordf %>%
rename(might_teach =
`Please tell us how you might teach (or already taught) with one or more of our case studies. (Example: for materials for students to practice writing about the results of a data analysis)`)
attr(educatordf$might_teach, "label") =
"Please tell us how you might teach (or already taught) with one or more of our case studies. (Example: for materials for students to practice writing about the results of a data analysis)"
educatordf = educatordf %>%
rename(type_student_taught =
`What type of students do you teach? (select all that apply)`)
attr(educatordf$type_student_taught, "label") =
"What type of students do you teach? (select all that apply)"
# seperating type_student_taught into boolean columns
educatordf %<>%
mutate(
teach_grad = case_when(
grepl("Graduate students", type_student_taught) == TRUE ~ "1",
is.na(type_student_taught) ~ "NA",
TRUE ~ "0"),
teach_ugrad = case_when(
grepl("Undergraduate students", type_student_taught) == TRUE ~ "1",
is.na(type_student_taught) ~ "NA",
TRUE ~ "0"),
teach_HS = case_when(
grepl("High school students", type_student_taught) == TRUE ~ "1",
is.na(type_student_taught) ~ "NA",
TRUE ~ "0"),
teach_middle = case_when(
grepl("Middle school students", type_student_taught) == TRUE ~ "1",
is.na(type_student_taught) ~ "NA",
TRUE ~ "0")
) %>% relocate(teach_grad, teach_ugrad, teach_HS, teach_middle,
.after = type_student_taught)
educatordf = educatordf %>%
rename(course_type =
`What type of course(s) would you (or have you) used our case studies for? (check all that apply)`)
attr(educatordf$course_type, "label") =
"What type of course(s) would you (or have you) used our case studies for? (check all that apply)"
# seperating course_type into boolean columns
educatordf %<>%
mutate(
would_use_PH_course = case_when(
grepl("Public Health", course_type) == TRUE ~ "1",
is.na(course_type) ~ "NA",
TRUE ~ "0"),
would_use_stats_course = case_when(
grepl("Statistics", course_type) == TRUE ~ "1",
is.na(course_type) ~ "NA",
TRUE ~ "0"),
would_use_math_course = case_when(
grepl("Math", course_type) == TRUE ~ "1",
is.na(course_type) ~ "NA",
TRUE ~ "0"),
would_use_DS_course = case_when(
grepl("Data Science", course_type) == TRUE ~ "1",
is.na(course_type) ~ "NA",
TRUE ~ "0")
) %>% relocate(would_use_PH_course, would_use_stats_course, would_use_math_course,
would_use_DS_course, .after = course_type)
educatordf = educatordf %>%
rename(case_studies =
`What case study(ies) have you looked at? (select all that apply)...53`)
educatordf %<>%
mutate(
case_studies = str_extract_all(case_studies,
paste(c("obesity:", "diet:", "school shootings",
"multicollinearity and RTC laws (wrangling)",
"multicollinearity and RTC laws (analysis)",
"predicting air pollution", "CO2 emissions",
"youth disconnection", "youth mental health",
"opioid shipments in the US", "None",
"vaping behaviours among US youths"), collapse = "|")),
case_studies = str_remove_all(case_studies, ":")
)
attr(educatordf$case_studies, "label") =
"What case study(ies) have you looked at? (select all that apply)...53"
# seperating case_studies into boolean columns
educatordf %<>%
mutate(
looked_at_obesity = case_when(
grepl("obesity", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_diet = case_when(
grepl("diet", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_school_shootings = case_when(
grepl("school shootings", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_RTC_wrangling = case_when(
grepl("multicollinearity and RTC laws (wrangling)", case_studies,
fixed = TRUE) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_RTC_analysis = case_when(
grepl("multicollinearity and RTC laws (analysis)", case_studies,
fixed = TRUE) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_air_pollution = case_when(
grepl("predicting air pollution", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_co2_emissions = case_when(
grepl("CO2 emissions", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_youth_disconnection = case_when(
grepl("youth disconnection", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_mental_health = case_when(
grepl("youth mental health", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_opioids = case_when(
grepl("opioid shipments in the US", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_vaping = case_when(
grepl("vaping behaviours among US youths", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0"),
looked_at_none = case_when(
grepl("None", case_studies) == TRUE ~ "1",
is.na(case_studies) ~ "NA",
TRUE ~ "0")
) %>% relocate(looked_at_obesity, looked_at_diet, looked_at_school_shootings,
looked_at_RTC_wrangling, looked_at_RTC_analysis,
looked_at_air_pollution, looked_at_co2_emissions,
looked_at_youth_disconnection, looked_at_mental_health,
looked_at_opioids, looked_at_vaping, looked_at_none,
.after = case_studies)
educatordf = educatordf %>%
rename(ocs_interest =
`Which case study or case studies might you be interested in using. (select all that apply)`)
educatordf %<>%
mutate(ocs_interest = gsub(": .*", "", str_remove(ocs_interest, "Case study about ")))
attr(educatordf$ocs_interest, "label") =
"Which case study or case studies might you be interested in using. (select all that apply)"
# separating ocs_interest into boolean columns
educatordf %<>%
mutate(
might_use_obesity = case_when(
grepl("obesity", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_diet = case_when(
grepl("diet", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_school_shootings = case_when(
grepl("school shootings", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_RTC_wrangling = case_when(
grepl("multicollinearity and RTC laws (wrangling)", ocs_interest,
fixed = TRUE) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_RTC_analysis = case_when(
grepl("multicollinearity and RTC laws (analysis)", ocs_interest,
fixed = TRUE) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_air_pollution = case_when(
grepl("predicting air pollution", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_co2_emissions = case_when(
grepl("CO2 emissions", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_youth_disconnection = case_when(
grepl("youth disconnection", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_mental_health = case_when(
grepl("youth mental health", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_opioids = case_when(
grepl("opioid shipments in the US", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_vaping = case_when(
grepl("vaping behaviours among US youths", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_none = case_when(
grepl("None", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0"),
might_use_not_sure = case_when(
grepl("Not sure yet", ocs_interest) == TRUE ~ "1",
is.na(ocs_interest) ~ "NA",
TRUE ~ "0")
) %>% relocate(might_use_obesity, might_use_diet, might_use_school_shootings,
might_use_RTC_wrangling, might_use_RTC_analysis,
might_use_air_pollution, might_use_co2_emissions,
might_use_youth_disconnection, might_use_mental_health,
might_use_opioids, might_use_vaping, might_use_none,
might_use_not_sure, .after = ocs_interest)
educatordf = educatordf %>%
rename(over18 =
`Are you 18 or over? You cannot participate in this survey if you are under 18.`)
attr(educatordf$over18, "label") =
"Are you 18 or over? You cannot participate in this survey if you are under 18."
educatordf = educatordf %>%
rename(feedback2 =
`Please provide any additional feedback you might have....76`)
attr(educatordf$feedback2, "label") =
"Please provide any additional feedback you might have....76"
educatordf = educatordf %>%
rename(parts_used =
`Are you interested in using just the data, part of case study, or a full case study?`)
educatordf %<>%
mutate(parts_used =
str_replace(parts_used, "Full case study \\(or case studies\\)", "Full") %>%
str_replace("Depends \\(sometimes just data, sometimes part or all of a case study\\)",
"Combination") %>%
str_replace("Just the data", "Data") %>%
str_replace("Only part of a case study \\(or case studies\\)", "Part"))
attr(educatordf$parts_used, "label") =
"Are you interested in using just the data, part of case study, or a full case study?"
attr(educatordf$parts_used, "values") =
list("Data" = "Just the data",
"Part" = "Only part of a case study (or case studies)",
"Full" = "Full case study (or case studies)",
"Combination" = "Depends (sometimes just data, sometimes part or all of a case study)")
# separating parts_used into boolean columns
educatordf %<>%
mutate(
interest_data = case_when(
parts_used == "Data" ~ "1",
is.na(parts_used) ~ "NA",
TRUE ~ "0"),
interest_part = case_when(
parts_used == "Part" ~ "1",
is.na(parts_used) ~ "NA",
TRUE ~ "0"),
interest_full = case_when(
parts_used == "Full" ~ "1",
is.na(parts_used) ~ "NA",
TRUE ~ "0"),
interest_combination = case_when(
parts_used == "Combination" ~ "1",
is.na(parts_used) ~ "NA",
TRUE ~ "0")
) %>% relocate(interest_data, interest_part, interest_full,
interest_combination, .after = parts_used)
educatordf = educatordf %>%
rename(materials_interest =
`Please tell us which materials you are most interested in using (or you already used to teach). (select all that apply)`)
attr(educatordf$materials_interest, "label") =
"Please tell us which materials you are most interested in using (or you already used to teach). (select all that apply)"
# separating materials_interest into boolean columns
educatordf %<>%
mutate(
motivation_interest = case_when(
grepl("Motivation/Context", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
import_interest = case_when(
grepl("Data Import", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
wrangling_interest = case_when(
grepl("Data Wrangling", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
exploration_interest = case_when(
grepl("Data Exploration", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
visualization_interest = case_when(
grepl("Data Visualization", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
analysis_interest = case_when(
grepl("Data Analysis", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
data_interest = case_when(
grepl("The data itself", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0"),
all_interest = case_when(
grepl("All sections", materials_interest) == TRUE ~ "1",
is.na(materials_interest) ~ "NA",
TRUE ~ "0")
) %>% relocate(motivation_interest, import_interest, wrangling_interest,
exploration_interest, visualization_interest, analysis_interest,
data_interest, all_interest, .after = materials_interest)
educatordf = educatordf %>%
rename(data_access1 =
`Is it clear how to locate, access, and download files from a case study repository?...81`)
attr(educatordf$data_access1, "label") =
"Is it clear how to locate, access, and download files from a case study repository?...81"
educatordf = educatordf %>%
rename(already_taught =
`Have you already used our case studies or the data from our case studies to teach?`)
attr(educatordf$already_taught, "label") =
"Have you already used our case studies or the data from our case studies to teach?"
educatordf = educatordf %>%
rename(ocs_taught =
`Which case studies (or data from a case study) did you use? (select all that apply)`)
educatordf %<>%
mutate(ocs_taught = gsub(": .*", "", str_remove(ocs_taught, "Case study about ")))
attr(educatordf$ocs_taught, "label") =
"Which case studies (or data from a case study) did you use? (select all that apply)"
# separate ocs_taught into boolean columns
educatordf %<>%
mutate(
used_obesity = case_when(
grepl("obesity", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_diet = case_when(
grepl("diet", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_school_shootings = case_when(
grepl("school shootings", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_RTC_wrangling = case_when(
grepl("multicollinearity and RTC laws (wrangling)", ocs_taught,
fixed = TRUE) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_RTC_analysis = case_when(
grepl("multicollinearity and RTC laws (analysis)", ocs_taught,
fixed = TRUE) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_air_pollution = case_when(
grepl("predicting air pollution", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_co2_emissions = case_when(
grepl("CO2 emissions", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_youth_disconnection = case_when(
grepl("youth disconnection", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_mental_health = case_when(
grepl("youth mental health", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_opioids = case_when(
grepl("opioid shipments in the US", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_vaping = case_when(
grepl("vaping behaviours among US youths", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_none = case_when(
grepl("None", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0"),
used_not_sure = case_when(
grepl("Not sure yet", ocs_taught) == TRUE ~ "1",
is.na(ocs_taught) ~ "NA",
TRUE ~ "0")
) %>% relocate(used_obesity, used_diet, used_school_shootings,
used_RTC_wrangling, used_RTC_analysis,
used_air_pollution, used_co2_emissions,
used_youth_disconnection, used_mental_health,
used_opioids, used_vaping, used_none,
used_not_sure, .after = ocs_taught)
educatordf = educatordf %>%
rename(courses_taught =
`What type of course(s) did you use our case studies or data for? (check all that apply)`)
attr(educatordf$courses_taught, "label") =
"What type of course(s) did you use our case studies or data for? (check all that apply)"
# separating courses_taught into boolean columns
educatordf %<>%
mutate(
taught_PH_course = case_when(
grepl("Public Health", courses_taught) == TRUE ~ "1",
is.na(courses_taught) ~ "NA",
TRUE ~ "0"),
taught_stats_course = case_when(
grepl("Statistics", courses_taught) == TRUE ~ "1",
is.na(courses_taught) ~ "NA",
TRUE ~ "0"),
taught_math_course = case_when(
grepl("Math", courses_taught) == TRUE ~ "1",
is.na(courses_taught) ~ "NA",
TRUE ~ "0"),
taught_DS_course = case_when(
grepl("Data Science", courses_taught) == TRUE ~ "1",
is.na(courses_taught) ~ "NA",
TRUE ~ "0")
) %>% relocate(taught_PH_course, taught_stats_course, taught_math_course,
taught_DS_course, .after = courses_taught)
educatordf = educatordf %>%
rename(data_access2 =
`Was it clear how to locate, access, and download files from a case study repository?`)
educatordf %<>%
mutate(data_access2 = str_replace(data_access2, "I found the files with a bit of difficulty",
"Not super clear"))
attr(educatordf$data_access2, "label") =
"Was it clear how to locate, access, and download files from a case study repository?"
educatordf = educatordf %>%
rename(how_taught =
`Please tell us how you taught with our data or case studies - Example: for a lecture about data wrangling or to have students write a report about a data analysis.`)
attr(educatordf$how_taught, "label") =
"Please tell us how you taught with our data or case studies - Example: for a lecture about data wrangling or to have students write a report about a data analysis."
educatordf = educatordf %>%
rename(data_save_time =
`Did using our data save you time?`)
attr(educatordf$data_save_time, "label") =
"Did using our data save you time?"
educatordf = educatordf %>%
rename(data_save_effort =
`Did using our data save you effort?`)
attr(educatordf$data_save_effort, "label") =
"Did using our data save you effort?"
educatordf = educatordf %>%
rename(teach_enjoyment =
`Compared to how you taught similar material previously, did you enjoy using the case studies to teach with?`)
attr(educatordf$teach_enjoyment, "label") =
"Compared to how you taught similar material previously, did you enjoy using the case studies to teach with?"
educatordf = educatordf %>%
rename(student_enjoyment =
`Compared to how you taught similar material previously, how well did your students seem to enjoy the case studies?`)
educatordf %<>%
mutate(student_enjoyment =
str_replace(student_enjoyment,
"My students did not enjoy learning with case study as well", "Worse") %>%
str_replace("They seemed to enjoy it about the same", "Same") %>%
str_replace("My students seemed to enjoy it better", "Better"))
attr(educatordf$student_enjoyment, "label") =
"Compared to how you taught similar material previously, how well did your students seem to enjoy the case studies?"
attr(educatordf$student_enjoyment, "values") =
list("Worse" = "My students did not enjoy learning with case study as well",
"Same" = "They seemed to enjoy it about the same",
"Better" = "My students seemed to enjoy it better")
educatordf = educatordf %>%
rename(future_data_use =
`Do you plan to use our data again in the future?`)
attr(educatordf$future_data_use, "label") =
"Do you plan to use our data again in the future?"
educatordf = educatordf %>%
rename(parts_taught =
`What did you use to teach?`)
educatordf %<>%
mutate(parts_taught =
str_replace(parts_taught, "Full case study", "Full") %>%
str_replace("Combination \\(sometimes just the data or part of the case study\\... etc\\.\\)",
"Combination") %>%
str_replace("Just the data", "Data") %>%
str_replace("Parts of a case study", "Part"))
attr(educatordf$parts_taught, "label") =
"What did you use to teach?"
attr(educatordf$parts_taught, "values") =
list("Data" = "Just the data",
"Part" = "Parts of a case study",
"Full" = "Full case study",
"Combination" = "Combination (sometimes just the data or part of the case study... etc.)")
# separating parts_taught into boolean columns
educatordf %<>%
mutate(
taught_data = case_when(
parts_taught == "Data" ~ "1",
is.na(parts_taught) ~ "NA",
TRUE ~ "0"),
taught_part = case_when(
parts_taught == "Part" ~ "1",
is.na(parts_taught) ~ "NA",
TRUE ~ "0"),
taught_full = case_when(
parts_taught == "Full" ~ "1",
is.na(parts_taught) ~ "NA",
TRUE ~ "0"),
taught_combination = case_when(
parts_taught == "Combination" ~ "1",
is.na(parts_taught) ~ "NA",
TRUE ~ "0")
) %>% relocate(taught_data, taught_part, taught_full,
taught_combination, .after = parts_taught)
educatordf = educatordf %>%
rename(modular_clarity =
`Was it clear how to use just part of the case study in a modular way?`)
attr(educatordf$modular_clarity, "label") =
"Was it clear how to use just part of the case study in a modular way?"
educatordf = educatordf %>%
rename(helpful_sections =
`Which sections were most helpful for you? (select all that apply)`)
attr(educatordf$helpful_sections, "label") =
"Which sections were most helpful for you? (select all that apply)"
# separating helpful_sections into boolean columns
educatordf %<>%
mutate(
motivation_helpful = case_when(
grepl("Motivation/Context/What are the data?", helpful_sections) == TRUE ~ "1",
is.na(helpful_sections) ~ "NA",
TRUE ~ "0"),
import_helpful = case_when(
grepl("Data Import", helpful_sections) == TRUE ~ "1",
is.na(helpful_sections) ~ "NA",
TRUE ~ "0"),
wrangling_helpful = case_when(
grepl("Data Wrangling", helpful_sections) == TRUE ~ "1",
is.na(helpful_sections) ~ "NA",
TRUE ~ "0"),
visualization_helpful = case_when(
grepl("Data Visualization", helpful_sections) == TRUE ~ "1",
is.na(helpful_sections) ~ "NA",
TRUE ~ "0"),
analysis_helpful = case_when(
grepl("Data Analysis", helpful_sections) == TRUE ~ "1",
is.na(helpful_sections) ~ "NA",
TRUE ~ "0")
) %>% relocate(motivation_helpful, import_helpful, wrangling_helpful,
visualization_helpful, analysis_helpful,
.after = helpful_sections)
educatordf = educatordf %>%
rename(do_different =
`Is there anything you would do differently next time?`)
attr(educatordf$do_different, "label") =
"Is there anything you would do differently next time?"
educatordf = educatordf %>%
rename(student_comprehension =
`Compared to how you taught similar material previously, how well did students seem to learn the content that you taught using a case study?`)
attr(educatordf$student_comprehension, "label") =
"Compared to how you taught similar material previously, how well did students seem to learn the content that you taught using a case study?"
educatordf = educatordf %>%
rename(future_cs_use =
`Do you plan to use our case studies (not just data) in the future?`)
attr(educatordf$future_cs_use, "label") =
"Do you plan to use our case studies (not just data) in the future?"
educatordf = educatordf %>%
rename(data_types =
`What type of data did you use? (select all that apply)`)
educatordf %<>%
mutate(data_types =
str_replace(data_types,
"Raw data files or original source \\(ex. a website\\)",
"Raw") %>%
str_replace("Wrangled data files \\(as rda files\\)",
"Wrangled RDA") %>%
str_replace("Wrangled data files \\(as csv files\\)",
"Wrangled CSV"))
attr(educatordf$data_types, "label") =
"What type of data did you use? (select all that apply)"
attr(educatordf$data_types, "values") =
list("Raw" = "Raw data files or original source (ex. a website)",
"Wrangled RDA" = "Wrangled data files (as rda files)",
"Wrangled CSV" = "Wrangled data files (as csv files)")
educatordf = educatordf %>%
rename(teaching_difference =
`How different was incorporating the case study or parts of the case study compared to how you typically teach similar material?`)
attr(educatordf$teaching_difference, "label") =
"How different was incorporating the case study or parts of the case study compared to how you typically teach similar material?"
educatordf = educatordf %>%
rename(cs_save_time =
`Did incorporating our case study materials into your class, save you time?`)
attr(educatordf$cs_save_time, "label") =
"Did incorporating our case study materials into your class, save you time?"
educatordf = educatordf %>%
rename(cs_save_effort =
`Did incorporating our case study materials into your class, save you effort?`)
attr(educatordf$cs_save_effort, "label") =
"Did incorporating our case study materials into your class, save you effort?"
educatordf = educatordf %>%
rename(learned_new =
`Did you learn anything new using the case studies?`)
attr(educatordf$learned_new, "label") =
"Did you learn anything new using the case studies?"
educatordf = educatordf %>%
rename(teaching_new =
`Did using our case studies allow you to incorporate something new into your teaching?`)
attr(educatordf$teaching_new, "label") =
"Did using our case studies allow you to incorporate something new into your teaching?"
educatordf = educatordf %>%
rename(biggest_benefit =
`What was the biggest benefit of using the case study?`)
attr(educatordf$biggest_benefit, "label") =
"What was the biggest benefit of using the case study?"
educatordf = educatordf %>%
rename(difficult_aspect =
`What was the most difficult aspect of using the case study?`)
attr(educatordf$difficult_aspect, "label") =
"What was the most difficult aspect of using the case study?"
educatordf = educatordf %>%
rename(typically_teach =
`How do you typically teach similar material?`)
attr(educatordf$typically_teach, "label") =
"How do you typically teach similar material?"
educatordf = educatordf %>%
rename(how_different_typical =
`If it was different from how you typically teach, how?`)
attr(educatordf$how_different_typical, "label") =
"If it was different from how you typically teach, how?"
```
checking for missed questions; if no missed questions, display the codebook
```{r educator_codebook}
educator_codebook = map_df(educatordf, function(x) attributes(x)$label) %>%
gather(key = Code, value = Label)
if(nrow(educator_codebook) == ncol(educator)){
educator_check = 1
educator_codebook
} else{
diff = ncol(educator) - nrow(educator_codebook)
educator_check = 0
print(paste("Missed", diff, "column(s)!"))
educatordf
}
```
student:
```{r studentdf}
studentdf = student %>%
rename(feedback1 =
`Please provide any additional feedback you might have....6`)
attr(studentdf$feedback1, "label") =
"Please provide any additional feedback you might have....6"
studentdf = studentdf %>%
rename(refer_back =
`How likely are you to refer back to the case study/studies in the future?...11`)
attr(studentdf$refer_back, "label") =
"How likely are you to refer back to the case study/studies in the future?...11"
studentdf = studentdf %>%
rename(famil_stats =
`How familiar were you with the statistical methods presented in the case study before you read it?...12`)
studentdf %<>%
mutate(
famil_stats = case_when(
famil_stats == "Never heard about the statistical topics covered" ~ "1",
famil_stats == "Had heard briefly about the statistical topics covered" ~ "2",
famil_stats == "Had an understanding about the topics but not as much as the case study covered"~ "3",
famil_stats == "Regularly perform the statistical methods covered/already knew all or most of the material" ~ "4",
TRUE ~ famil_stats
)
) #%>%
#mutate(famil_stats = as.numeric(famil_stats))
attr(studentdf$famil_stats, "label") = "How familiar were you with the statistical methods presented in the case study before you read it?...12"
attr(studentdf$famil_stats, "values") =
list("1" = "Never heard about the statistical topics covered",
"2" = "Had heard briefly about the statistical topics covered",
"3" = "Had an understanding about the topics but not as much as the case study covered",
"4" = "Regularly perform the statistical methods covered/already knew all or most of the material")
studentdf = studentdf %>%
rename(recommend =
`How likely are you to recommend the case studies to others?...16`)
attr(studentdf$recommend, "label") =
"How likely are you to recommend the case studies to others?...16"
studentdf = studentdf %>%
rename(famil_PH =
`How familiar were you with the public health topics presented in the case study before you read it?...19`)
studentdf %<>%
mutate(
famil_PH = case_when(
famil_PH == "Never heard about the public health topics" ~ "1",
famil_PH == "Had heard briefly about the topics" ~ "2",
famil_PH == "Had an understanding about the topics but not as much as the case study covered"~ "3",
famil_PH == "Already knew all or most of the material" ~ "4",
TRUE ~ famil_PH
)
) #%>%
#mutate(famil_PH = as.numeric(famil_PH))
attr(studentdf$famil_PH, "label") =
"How familiar were you with the public health topics presented in the case study before you read it?...19"
attr(studentdf$famil_PH, "values") =
list("1" = "Never heard about the public health topics",
"2" = "Had heard briefly about the topics",
"3" = "Had an understanding about the topics but not as much as the case study covered",
"4" = "Already knew all or most of the material")
studentdf = studentdf %>%
rename(famil_DS =
`How familiar were you with the data science topics presented in the case study before you read it?...20`)
studentdf %<>%
mutate(
famil_DS = case_when(
famil_DS == "Never heard about the data science topics" ~ "1",
famil_DS == "Had heard briefly about the topics" ~ "2",
famil_DS == "Had an understanding about the topics but not as much as the case study covered"~ "3",
famil_DS == "Already knew all or most of the material" ~ "4",
TRUE ~ famil_DS
)
) #%>%
#mutate(famil_DS = as.numeric(famil_DS))
attr(studentdf$famil_DS, "label") =
"How familiar were you with the data science topics presented in the case study before you read it?...20"
attr(studentdf$famil_DS, "values") =
list("1" = "Never heard about the data science topics",
"2" = "Had heard briefly about the topics",
"3" = "Had an understanding about the topics but not as much as the case study covered",
"4" = "Already knew all or most of the material")
studentdf = studentdf %>%
rename(learned_new =
`I learned something new about: (select all that apply)...21`)
studentdf %<>%
mutate(
learned_new = str_replace_all(learned_new, "How to implement a statistical method using R", "Rstats"),
learned_new = str_replace_all(learned_new, "A statistical method or concept", "statistics")
) %>%
mutate(
learned_new =
str_extract_all(learned_new,
paste(c("statistics","Rstats", "import", "visualization",
"wrangling", "communication", "public health",
"All of the above", "None"), collapse="|"))
)
attr(studentdf$learned_new, "label") =
"I learned something new about: (select all that apply)...21"
attr(studentdf$learned_new, "values") =
list("statistics" = "A statistical method or concept",
"Rstats" = "How to implement a statistical method using R",
"import" = "Data import methods",
"visualization" = "Data visualization methods",
"wrangling" = "Data wrangling methods",
"communication" = "Data communication methods",
"public health" = "The public health topics presented")
# separating learned_new into boolean columns
studentdf %<>%
mutate(
learned_new_stats = case_when(
grepl("statistics", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_Rstats = case_when(
grepl("Rstats", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_import = case_when(
grepl("import", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_viz = case_when(
grepl("visualization", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_wrang = case_when(
grepl("wrangling", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_comm = case_when(
grepl("communication", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_PH = case_when(
grepl("public health", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_all = case_when(
grepl("All of the above", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0"),
learned_new_none = case_when(
grepl("None", learned_new) == TRUE ~ "1",
is.na(learned_new) ~ "NA",
TRUE ~ "0")
) %>% relocate(learned_new_stats, learned_new_Rstats, learned_new_import, learned_new_viz,