-
Notifications
You must be signed in to change notification settings - Fork 10
/
Annotated Cleaning Documentation.Rmd
3548 lines (3094 loc) · 168 KB
/
Annotated Cleaning Documentation.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: "Psycorona - Data Cleaning Documentation"
subtitle: "Step by step description"
author: "PsyCorona: Max, Jannis & Ben"
date: "3/30/2020"
output:
html_document:
code_folding: hide
mathjax: default
theme: yeti
toc: yes
toc_float: yes
editor_options:
chunk_output_type: console
---
<style type="text/css">
.main-container {
max-width: 1300px;
margin-left: auto;
margin-right: auto;
}
.table {
margin-left:auto;
margin-right:auto;
}
</style>
```{r setup, include=FALSE}
# R Studio Clean-Up
cat("\014") # clear console
rm(list=ls()) # clear workspace
gc # garbage collector
# Install and Load Packages
# if(!require(pacman)) install.packages("pacman")
# require(pacman)
# pacman::p_load(psych, ggplot2, ggthemes, haven, data.table, dplyr, tidyr, Hmisc, mada,
# knitr, kableExtra, naniar, stats, readxl, matrixStats, ISOcodes, pander,
# Scale, haven, lubridate, naniar, stats)
lib <- c("psych", "ggplot2", "ggthemes", "haven", "data.table", "dplyr", "tidyr", "Hmisc", "mada",
"knitr", "kableExtra", "naniar", "stats", "readxl", "matrixStats", "ISOcodes", "pander", "lubridate")
# "Scale"
invisible(lapply(lib, library, character.only = TRUE))
lapply(lib, library, character.only = TRUE)
rm(lib)
# Load Custom Packages
source("./scripts/functions/fun.panel.R")
source("./scripts/functions/themes.R")
source("./scripts/functions/dictionary_functions.R")
source("./scripts/functions/recode_if.R")
# Markdown Options
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) # set working directory
knitr::opts_knit$get("root.dir") # check working directory
options(scipen = 999, digits = 4, width = 400) #removes scientific quotation
#knitr::opts_chunk$set(echo = TRUE, cache = F, cache.path = rprojroot::find_rstudio_root_file('cache/')) # cache settings
knitr::knit_hooks$set(
error = function(x, options) {
paste('\n\n<div class="alert alert-danger">',
gsub('##', '\n', gsub('^##\ Error', '**Error**', x)),
'</div>', sep = '\n')
},
warning = function(x, options) {
paste('\n\n<div class="alert alert-warning">',
gsub('##', '\n', gsub('^##\ Warning:', '**Warning**', x)),
'</div>', sep = '\n')
},
message = function(x, options) {
paste('\n\n<div class="alert alert-info">',
gsub('##', '\n', x),
'</div>', sep = '\n')
}
)
htmltools::tagList(rmarkdown::html_dependency_font_awesome())
# Global Chunk Options
knitr::opts_chunk$set(echo = TRUE)
```
Note. Boxplots display the interquartile range (IQR, center box), and the whiskers extend 1.5*IQR from the lower and upper hinge. The white point indicates the mean and the white center line indicates the median.
<br/>
## **Import Data**
In a first step we import the raw Qualtrics data, which was downloaded as an SPSS file.
### Baseline
```{r LoadRawBase, echo=T, warning=F, message=F}
# Reset working directory to folder current file is saved in
#setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
# Import RuG Snowball
dt0RawRUG <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Baseline.\\-.RUG.General", full.names = TRUE, ignore.case = TRUE))
dt0RawRUG$source <- "RUG"
# RUG Representative sample
dt0RawRepRUG <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Baseline.\\-.RUG.Representative", full.names = TRUE, ignore.case = TRUE))
dt0RawRepRUG$source <- "Rep RUG"
dt0RawRepRUG$country <- dt0RawRepRUG$country_new #fixed here but later in MTurk
# NYU Snowball
dt0RawNYUAD <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Baseline.\\-.NYUAD.General", full.names = TRUE, ignore.case = TRUE))
dt0RawNYUAD$source <- "NYU-AD"
# NYU representative
dt0RawRepNYUAD <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Baseline.\\-.NYUAD.Representative", full.names = TRUE, ignore.case = TRUE))
dt0RawRepNYUAD$source <- "Rep NYU-AD"
# Iranian data
dt0RawIran <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Baseline.\\-.Iran", full.names = TRUE, ignore.case = TRUE))
dt0RawIran$source <- "Iran"
# How Nuts are the Dutch data
dt0RawHNATD <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "HNDPsyC19", full.names = TRUE, ignore.case = TRUE))
dt0RawHNATD$source <- "HNATD"
# Flycatcher data
dt0RawFly <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Flycatcher", full.names = TRUE, ignore.case = TRUE))
dt0RawFly$source <- "Fly"
# Chinese data
dt0RawChina <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "China", full.names = TRUE, ignore.case = TRUE))
dt0RawChina$source <- "Rep China"
# prepare dfs before merge (basically naming variables correct)
notRug <- dt0RawRUG %>%
dplyr::select_if(!(names(dt0RawRUG) %in% names(dt0RawNYUAD)))
notNyu <- dt0RawNYUAD %>%
dplyr::select_if(!(names(dt0RawNYUAD) %in% names(dt0RawRUG)))
notRepRug <- dt0RawRepRUG %>%
dplyr::select_if(!(names(dt0RawRepRUG) %in% names(dt0RawNYUAD)))
notRepNYU <- dt0RawRepNYUAD %>%
dplyr::select_if(!(names(dt0RawRepNYUAD) %in% names(dt0RawNYUAD)))
names(notRug)
names(notNyu)
cat("Looks good as non-overlapping variables pertain to the political items"); rm(notRug, notNyu)
names(notRepRug)
names(notRepNYU)
cat("Looks good as country_new is calculated by Qualtrics"); rm(notRepRug, notRepNYU)
# check dataset from Iran
notRepIran <- dt0RawIran %>%
dplyr::select_if(!(names(dt0RawIran) %in% names(dt0RawNYUAD)))
names(notRepIran)
cat("All variables have theo correct names in the Iranian dataset"); rm(notRepIran)
# check dataset from HNATD
notRepHNATD <- dt0RawHNATD %>%
dplyr::select_if(!(names(dt0RawHNATD) %in% names(dt0RawNYUAD)))
names(notRepHNATD)
cat("Variables that do not match are no problem"); rm(notRepHNATD)
# check dataset from Flycatcher
notRepFly <- dt0RawFly %>%
dplyr::select_if(!(names(dt0RawFly) %in% names(dt0RawNYUAD)))
names(notRepFly)
cat("Variables that do not match are no problem"); rm(notRepFly)
# check dataset from China
notRepChina <- dt0RawChina %>%
dplyr::select_if(!(names(dt0RawChina) %in% names(dt0RawNYUAD)))
names(notRepChina)
cat("Variables that do not match are no problem"); rm(notRepChina)
# merge adn fill missing
dt0Raw <- plyr::rbind.fill(dt0RawRUG, dt0RawNYUAD, dt0RawRepNYUAD, dt0RawRepRUG, dt0RawIran, dt0RawHNATD, dt0RawFly, dt0RawChina)
rm(dt0RawRUG, dt0RawNYUAD, dt0RawRepNYUAD, dt0RawRepRUG, dt0RawIran, dt0RawHNATD)
```
The raw data set includes `r length(dt0Raw)` variables for `r nrow(dt0Raw)` cases.
### Recontacts
```{r LoadRawRec, echo=T, warning=F, message=F}
# Import Wave 1
dt0w1 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.1...M", full.names = TRUE, ignore.case = TRUE))
dt0w2 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.2...A", full.names = TRUE, ignore.case = TRUE))
dt0w3 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.3", full.names = TRUE, ignore.case = TRUE))
dt0w4 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.4", full.names = TRUE, ignore.case = TRUE))
dt0w5 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.5", full.names = TRUE, ignore.case = TRUE))
dt0w6 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.6", full.names = TRUE, ignore.case = TRUE))
dt0w7 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.7", full.names = TRUE, ignore.case = TRUE))
dt0w8 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.8", full.names = TRUE, ignore.case = TRUE))
dt0w9 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.9", full.names = TRUE, ignore.case = TRUE))
dt0w10 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.10", full.names = TRUE, ignore.case = TRUE))
dt0w11 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.11", full.names = TRUE, ignore.case = TRUE))
dt0w12 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.12", full.names = TRUE, ignore.case = TRUE))
dt0w13 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.13", full.names = TRUE, ignore.case = TRUE))
dt0w14 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.14", full.names = TRUE, ignore.case = TRUE))
dt0w15 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.15", full.names = TRUE, ignore.case = TRUE))
dt0w16 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.16", full.names = TRUE, ignore.case = TRUE))
dt0w17 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.17", full.names = TRUE, ignore.case = TRUE))
dt0w18 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.18", full.names = TRUE, ignore.case = TRUE))
dt0w19 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.19", full.names = TRUE, ignore.case = TRUE))
dt0w20 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.20", full.names = TRUE, ignore.case = TRUE))
dt0w21 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.21", full.names = TRUE, ignore.case = TRUE))
dt0w22 <- haven::read_spss(dir("data/collab data/Shared/Data/raw data", pattern = "Wave.22", full.names = TRUE, ignore.case = TRUE))
# all studies were redownloaded on 28/10/2021
# prepare dfs before merge (basically naming variables correct)
notBasew1 <- dt0w1 %>%
dplyr::select_if(!(names(dt0w1) %in% names(dt0Raw)))
notBasew2 <- dt0w2 %>%
dplyr::select_if(!(names(dt0w2) %in% names(dt0Raw)))
notBasew3 <- dt0w3 %>%
dplyr::select_if(!(names(dt0w3) %in% names(dt0Raw)))
notBasew4 <- dt0w4 %>%
dplyr::select_if(!(names(dt0w4) %in% names(dt0Raw)))
notBasew5 <- dt0w5 %>%
dplyr::select_if(!(names(dt0w5) %in% names(dt0Raw)))
notBasew6 <- dt0w6 %>%
dplyr::select_if(!(names(dt0w6) %in% names(dt0Raw)))
notBasew7 <- dt0w7 %>%
dplyr::select_if(!(names(dt0w7) %in% names(dt0Raw)))
notBasew8 <- dt0w8 %>%
dplyr::select_if(!(names(dt0w8) %in% names(dt0Raw)))
notBasew9 <- dt0w9 %>%
dplyr::select_if(!(names(dt0w9) %in% names(dt0Raw)))
notBasew10 <- dt0w10 %>%
dplyr::select_if(!(names(dt0w10) %in% names(dt0Raw)))
notBasew11 <- dt0w11 %>%
dplyr::select_if(!(names(dt0w11) %in% names(dt0Raw)))
notBasew12 <- dt0w12 %>%
dplyr::select_if(!(names(dt0w12) %in% names(dt0Raw)))
notBasew13 <- dt0w13 %>%
dplyr::select_if(!(names(dt0w13) %in% names(dt0Raw)))
notBasew14 <- dt0w14 %>%
dplyr::select_if(!(names(dt0w14) %in% names(dt0Raw)))
notBasew15 <- dt0w15 %>%
dplyr::select_if(!(names(dt0w15) %in% names(dt0Raw)))
notBasew16 <- dt0w16 %>%
dplyr::select_if(!(names(dt0w16) %in% names(dt0Raw)))
notBasew17 <- dt0w17 %>%
dplyr::select_if(!(names(dt0w17) %in% names(dt0Raw)))
notBasew18 <- dt0w18 %>%
dplyr::select_if(!(names(dt0w18) %in% names(dt0Raw)))
notBasew19 <- dt0w19 %>%
dplyr::select_if(!(names(dt0w19) %in% names(dt0Raw)))
notBasew20 <- dt0w20 %>%
dplyr::select_if(!(names(dt0w20) %in% names(dt0Raw)))
notBasew21 <- dt0w21 %>%
dplyr::select_if(!(names(dt0w21) %in% names(dt0Raw)))
notBasew22 <- dt0w22 %>%
dplyr::select_if(!(names(dt0w22) %in% names(dt0Raw)))
cat("Missmatch between wave 1 and baseline:")
names(notBasew1) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Checked and all mismatches were added later!"); rm(notBasew1)
cat("Missmatch between wave 2 and baseline:")
names(notBasew2) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Checked and all mismatches were added later!"); rm(notBasew2)
cat("Missmatch between wave 3 and baseline:")
names(notBasew3) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Checked and all mismatches were added later!"); rm(notBasew3)
cat("Missmatch between wave 4 and baseline:")
names(notBasew4) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Checked and all mismatches were added later!"); rm(notBasew4)
cat("Missmatch between wave 5 and baseline:")
names(notBasew5) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew5)
cat("Missmatch between wave 6 and baseline:")
names(notBasew6) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew6)
cat("Missmatch between wave 7 and baseline:")
names(notBasew7) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew7)
cat("Missmatch between wave 8 and baseline:")
names(notBasew8) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew8)
cat("Missmatch between wave 9 and baseline:")
names(notBasew9) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew9)
cat("Missmatch between wave 10 and baseline:")
names(notBasew10) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Still needs checking"); rm(notBasew10)
cat("Missmatch between wave 11 and baseline:")
names(notBasew11) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("fail01 is twice in there"); rm(notBasew11)
cat("Missmatch between wave 12 and baseline:")
names(notBasew12) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew12)
cat("Missmatch between wave 13 and baseline:")
names(notBasew13) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew13)
cat("Missmatch between wave 14 and baseline:")
names(notBasew14) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew14)
cat("Missmatch between wave 15 and baseline:")
names(notBasew15) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew15)
cat("Missmatch between wave 16 and baseline:")
names(notBasew16) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew16)
cat("Missmatch between wave 17 and baseline:")
names(notBasew17) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew17)
cat("Missmatch between wave 18 and baseline:")
names(notBasew18) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew18)
cat("Missmatch between wave 19 and baseline:")
names(notBasew19) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew19)
cat("Missmatch between wave 20 and baseline:")
names(notBasew20) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew20)
cat("Missmatch between wave 21 and baseline:")
names(notBasew21) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew21)
cat("Missmatch between wave 22 and baseline:")
names(notBasew22) %>% # get missmatch names
data.frame()%>%
filter(!grepl("t_",.), #filter timer
!grepl("_DO_",.), #filter display order
!grepl("_Count",.), #filter Click Counts
!grepl("_Submit",.)) #filter Submit
cat("Looks good"); rm(notBasew22)
```
## **Data Quality**
### Baseline
#### Filter: Preview Responses
Filter the Preview responses.
```{r preview, echo=T, warning=F, message=F}
# flag Preview Responses
# labelled slow
# dt1Preview <- dt0Raw %>%
# mutate(FilterPreview = labelled(ifelse(Status == 0,0,1),
# labels = c(preview = 1), label="Filter: survey preview response"))
# not labelled fast
dt1Preview <- dt0Raw %>%
mutate(FilterPreview = ifelse(Status == 0,0,1))
# dt0Raw$FilterPreview <- as.numeric(!dt0Raw$Status == 0)
```
#### Filter: Survey Progress (drop out)
<!-- https://cran.r-project.org/web/packages/naniar/vignettes/naniar-visualisation.html -->
Inspecting missing data in the items.
```{r Missing, echo=T, warning=F, message=F}
# Table: Missing Data per item
dt1Preview %>%
dplyr::select(-starts_with("t_"), -starts_with("Pol")) %>% #drop timers and Political orientation (because of translation missingness)
dplyr::select_if(~sum(is.na(.)) > 0) %>% # remove all variables that have no missingess
naniar::miss_var_summary(.) %>% # by variable summary of missingness proportion
DT::datatable(.,
colnames = c("Variable", "Number Missing", "Percentage Missing"),
filter = 'top',
extensions = 'Buttons',
options = list(
columnDefs = list(list(className = 'dt-center')),
#autoWidth = TRUE,
dom = 'Bfrtlip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print'))) %>%
DT::formatRound('pct_miss', digits = 2)
# Plot: Missing Data per item
dt1Preview %>%
dplyr::select(-starts_with("t_"), -starts_with("Pol")) %>% #drop timers and Political orientation (because of translation missingness)
dplyr::select_if(~sum(is.na(.)) > 0) %>% # remove all variables that have no missingess
naniar::gg_miss_var(.) # visualize by variable summary of missingness proportion
# Plot: Missing Data cumulative
dt1Preview %>%
dplyr::select(-starts_with("t_"), -starts_with("Pol")) %>% #drop timers and Political orientation (because of translation missingness)
dplyr::select_if(~sum(is.na(.)) > 0) %>% # remove all variables that have no missingess
naniar::gg_miss_var_cumsum(.) # missingness development over survey
# Co-occurences of missingess - too many variables
#dt0Raw %>%
# dplyr::select(-starts_with("t_"), -starts_with("Pol")) %>% #drop timers and Political orientation (because of translation missingness)
# dplyr::select_if(~sum(is.na(.)) > 0) %>% # remove all variables that have no missingess
# naniar::gg_miss_upset(., nsets = n_var_miss(.)) # visualize missingess co-occurences
rm(dt0Raw, dt0RawChina, dt0RawFly)
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt1Preview %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2) # percent of missing data with current cut-off criterion
# plot histogram and missing (COMMENTED FOR TIME)
# ggplot(data=progressFilter, aes(x=Progress, fill=out)) +
# geom_histogram(bins=50,
# alpha=.6) +
# geom_vline(xintercept = progressCutOff,
# color = "darkred",
# linetype = "longdash") +
# geom_text(aes(x=progressCutOff, label=paste0("Progress cut-off: ",progressCutOff,"%\n"), y=Inf),
# hjust = 1,
# colour="darkred",
# angle=90) +
# geom_text(aes(x=progressCutOff, label=paste0("\ndata loss: ",progressCutOffPerc,"%"), y=Inf),
# hjust = 1,
# colour="darkred",
# angle=90) +
# #scale_x_continuous(breaks = seq(0, 100,3)) +
# scale_fill_manual(values=c("darkgrey","darkred")) +
# labs(title = "Histogram: Survey Progress",
# x = "Survey Progress [Percent completed]",
# y = "Frequency Count") +
# theme_Publication() +
# theme(legend.position = "none")
# flag anyone with less than 5 minutes survey duration
# labelled slow
# dt2Progress <- dt1Preview %>%
# mutate(FilterProgress = labelled(ifelse(Progress < progressCutOff,1,0),
# labels = c(`consent` = 1), label="Filter: Did not see debriefing"))
# not labelled fast
dt2Progress <- dt1Preview %>%
mutate(FilterProgress = ifelse(Progress < progressCutOff,1,0))
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter: Short Duration on Survey
Filter survey responses that were shorter than 5 minutes.
```{r Duration, echo=T, warning=F, message=F}
# truncate data:
tOutlierHigh <- dt2Progress %>%
dplyr::select(Duration__in_seconds_) %>%
filter(Duration__in_seconds_<=stats::median(Duration__in_seconds_)+stats::mad(Duration__in_seconds_)*3.5) %>%
mutate(Minutes = Duration__in_seconds_/60)
# set time cut-off criterion:
tCutOff <- 5 #cut-off criterion in minutes
# CJ: This might be a bit strict, I suspect that I completed it in <10 minutes.
tCutOffPerc <- round(sum(tOutlierHigh$Minutes<tCutOff)/nrow(dt2Progress)*100,2) # percent of missing data with current cut-off criterion
tOutlierHigh$out <- tOutlierHigh$Minutes < tCutOff
# plot histogram and missing (COMMENTED FOR TIME)
# ggplot(data=tOutlierHigh, aes(x=Minutes, fill=out)) +
# geom_histogram(bins=round(max(tOutlierHigh$Minutes),0),
# alpha=.6) +
# geom_vline(xintercept = tCutOff,
# color = "darkred",
# linetype = "longdash") +
# geom_text(aes(x=tCutOff, label=paste0("time cut-off: ",tCutOff," Minutes\n"), y=Inf),
# hjust = 1,
# colour="darkred",
# angle=90) +
# geom_text(aes(x=tCutOff, label=paste0("\ndata loss: ",tCutOffPerc,"%"), y=Inf),
# hjust = 1,
# colour="darkred",
# angle=90) +
# scale_x_continuous(breaks = seq(0, round(max(tOutlierHigh$Minutes),0), 5)) +
# scale_fill_manual(values=c("darkgrey","darkred")) +
# labs(title = "Truncated Histogram: Survey Duration",
# x = "Duration [Mintues]",
# y = "Frequency Count",
# caption = "Notes:
# (1) Truncated: all participants who took less time than Median+3.5*MAD
# (2) Each bin represents one Minute") +
# theme_Publication() +
# theme(legend.position = "none")
# flag anyone with less than 5 minutes survey duration
# labelled slow
# dt3Time <- dt2Progress %>%
# mutate(FilterTime = labelled(ifelse(Duration__in_seconds_ > tCutOff*60,0,1),
# labels = c(`extremely quick` = 1), label="Filter: Took less than 5 minutes on survey"))
# not labelled fast
dt3Time <- dt2Progress %>%
mutate(FilterTime = ifelse(Duration__in_seconds_ > tCutOff*60,0,1),
FilterTimeQualtrics = ifelse(Duration__in_seconds_ > 365,0,1))
rm(tOutlierHigh, tCutOff, tCutOffPerc, dt2Progress)
# flag anyone with less than 5 minutes survey duration
# labelled slow
# dt2Time <- dt1Preview %>%
# mutate(FilterTime = labelled(ifelse(Duration__in_seconds_ > 300,0,1),
# labels = c(`extremely quick` = 1), label="Filter: Took less than 5 minutes on survey"))
# not labelled fast
# dt2Time <- dt1Preview %>%
# mutate(ifelse(Duration__in_seconds_ > 300,0,1))
rm(dt1Preview)
```
#### Filter: Straightliners
Filter participants, who have straightlined on the job insecurity scale, which includes a reverse coded item. We only flag people who straightlined outside the median categories because all "neither agree nor disagree" might be meaningful response.
```{r Straightliner, echo=T, warning=F, message=F}
# CheckMissingness pattern
naniar::gg_miss_upset(dt3Time %>%
dplyr::select(ResponseId, jbInsec01, jbInsec02, jbInsec03) %>%
na_if(., -99) # all -99 into <NA>
)
# isolate respondents who have straightlined outside a the median categories (b/c all "neither agree nor disagree" might be meaningful response)
jobinsecRed <- dt3Time %>%
dplyr::select(ResponseId, jbInsec01, jbInsec02, jbInsec03) %>%
na_if(., -99) %>% # all -99 into <NA>
na.omit() %>% # remove people who have missing data on one of the three items
mutate(mean = rowMeans(dplyr::select(., c("jbInsec01", "jbInsec02", "jbInsec03"))),
sd = matrixStats::rowSds(as.matrix(dplyr::select(., c("jbInsec01", "jbInsec02", "jbInsec03"))))) %>% # calculate row-means and row-sds
filter(sd == 0, mean != 0)
# flag anyone who straightlined on job insecurity
# labelled slow
# dt4Straightliner <- dt3Time %>%
# mutate(FilterStraightliner = labelled(ifelse(!ResponseId %in% jobinsecRed$ResponseId,0,1),
# labels = c(straightliner = 1), label="Filter: straightliner on Job Insecurity"))
# not labelled fast
dt4Straightliner <- dt3Time %>%
mutate(FilterStraightliner = ifelse(!ResponseId %in% jobinsecRed$ResponseId,0,1))
rm(jobinsecRed, dt3Time)
```
### Recontacts
#### Filter w1: Survey Progress
```{r recSurvProgw1, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent (check each wave for correct number)
progressFilter <- dt0w1 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w1 <- dt0w1 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w2: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 95 #cut-off criterion in percent (check each wave for correct number)
progressFilter <- dt0w2 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w2 <- dt0w2 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w3: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 95 #cut-off criterion in percent (NEEDS CHANGING; NO DROPOUTS YET)
progressFilter <- dt0w3 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w3 <- dt0w3 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w4: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 95 #cut-off criterion in percent (NEEDS CHANGING; NO DROPOUTS YET)
progressFilter <- dt0w4 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w4 <- dt0w4 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w5: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 95 #cut-off criterion in percent (NEEDS CHANGING; NO DROPOUTS YET)
progressFilter <- dt0w5 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w5 <- dt0w5 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w6: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 95 #cut-off criterion in percent (NEEDS CHANGING; NO DROPOUTS YET)
progressFilter <- dt0w6 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w6 <- dt0w6 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w7: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w7 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w7 <- dt0w7 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w8: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w8 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w8 <- dt0w8 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w9: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w9 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w9 <- dt0w9 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w10: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w10 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w10 <- dt0w10 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w11: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w11 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w11 <- dt0w11 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w12: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w12 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w12 <- dt0w12 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w13: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w13 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w13 <- dt0w13 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w14: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w14 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w14 <- dt0w14 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w15: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w15 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w15 <- dt0w15 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w16: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w16 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w16 <- dt0w16 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w17: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w17 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w17 <- dt0w17 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w18: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w18 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w18 <- dt0w18 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w19: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w19 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w19 <- dt0w19 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w20: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w20 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w20 <- dt0w20 %>%
filter(progressFilter$out == F)
rm(progressFilter, progressCutOff, progressCutOffPerc)
```
#### Filter w21: Survey Progress
```{r recSurvProg, echo=T, warning=F, message=F}
# set time cut-off criterion:
progressCutOff <- 97 #cut-off criterion in percent
progressFilter <- dt0w21 %>%
dplyr::select(Progress) %>%
mutate(out = Progress < progressCutOff)
table(progressFilter$out)
(progressCutOffPerc <- round(sum(progressFilter$out)/nrow(progressFilter)*100,2)) # percent of missing data with current cut-off criterion
# throw them out before the merge
dt0w21 <- dt0w21 %>%
filter(progressFilter$out == F)