-
Notifications
You must be signed in to change notification settings - Fork 8
/
ParentAppData_CleaningAndAnalysis.R
1581 lines (1075 loc) · 79.5 KB
/
ParentAppData_CleaningAndAnalysis.R
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
# run libraries
library(tidyverse)
library(here)
#Source the personal setup for data
source(here("config", "Personal Setup.R"))
#Get data from excel
UIC.Tracker <- rio::import(file = here("data", "UIC Tracker.xlsx"), which = "UIC Tracker 211014")
#Get the List of PLH Tables and data from server
plh_tables <- dbListTables(plh_con)
df <- dbReadTable(plh_con, plh_tables[2])
#Source the personal setup for data
#Manuel step source("Personal Setup Script.R")
#Source the data cleaning and setup
source(here("ParentAppData_setupclean.R"))
#Write clean data back to Metabase
dbWriteTable(parent_app_con, "Cleaned PLH data", select(plhdata_org_clean,!(contact_fields)), overwrite=TRUE)
# Define list of organisations
orgs_list <- levels(plhdata_org_clean$Org)
# Show the summary of app versions
sjPlot::sjtab(data=plhdata_org_clean, Org, app_version, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Subset the data
#####Create a subset for an organisation NONTOBEKO####
# Create subsets of the data based on organisation NONTOBEKO
Organization_Table(data=plhdata_org, Org_name = "Nontobeko")
#plhdata_org_NONTOBEKO <- filter(plhdata_org, Org == "Nontobeko")
# Show any app user ids that are invalid and do not come from the app.
#plhdata_org_NONTOBEKO %>% filter(is.na(plhdata_org_NONTOBEKO$'app_version')) %>% select('app_user_id')
# Create subsets of the data based on valid NONTOBEKOM app user ID's
#plhdata_org_NONTOBEKO <- filter(plhdata_org_NONTOBEKO, !is.na(plhdata_org_NONTOBEKO$'app_version'))
# Show the summary of app versions
#sjmisc::frq(x=plhdata_org_NONTOBEKO$'app_version', out="txt")
# Show any app user ids that have only synced initial data.
plhdata_org_NONTOBEKO %>% filter(is.na(plhdata_org_NONTOBEKO$rp.contact.field.first_app_open)) %>% select('app_user_id')
#####Create a subset for an organisation DLALANATHI####
# Create subsets of the data based on organisation DLALANATHI
Organization_Table(data=plhdata_org, Org_name = "Dlalanathi")
# Show any app user ids that have only synced initial data [done for each Org under subsetting but also with for loop further below]
plhdata_org_DLALANATHI %>% filter(is.na(plhdata_org_DLALANATHI$rp.contact.field.first_app_open)) %>% select('app_user_id')
#####Create a subset for an organisation HILLCREST####
Organization_Table(data=plhdata_org, Org_name = "Hillcrest")
#plhdata_org_HILLCREST <- filter(plhdata_org, Org == "Hillcrest")
# Show any app user ids that are invalid and do not come from the app.
#plhdata_org_HILLCREST %>% filter(is.na(plhdata_org_HILLCREST$'app_version')) %>% select('app_user_id')
# Create subsets of the data based on valid HILLCREST app user ID's
#plhdata_org_HILLCREST <- filter(plhdata_org_HILLCREST, !is.na(plhdata_org_HILLCREST$'app_version'))
# Show the summary of app versions
#sjmisc::frq(x=plhdata_org_HILLCREST$'app_version', out="txt")
# Show any app user ids that have only synced initial data.
plhdata_org_HILLCREST %>% filter(is.na(plhdata_org_HILLCREST$rp.contact.field.first_app_open)) %>% select('app_user_id')
#####Create a subset for an organisation Joy####
Organization_Table(data=plhdata_org, Org_name = "Joy")
# Create subsets of the data based on organisation Joy
#plhdata_org_Joy <- filter(plhdata_org, Org == "Joy")
# Show any app user ids that are invalid and do not come from the app.
#plhdata_org_Joy %>% filter(is.na(plhdata_org_Joy$'app_version')) %>% select('app_user_id')
# Create subsets of the data based on valid Joy app user ID's
#plhdata_org_Joy <- filter(plhdata_org_Joy, !is.na(plhdata_org_Joy$'app_version'))
# Show the summary of app versions
#sjmisc::frq(x=plhdata_org_Joy$'app_version', out="txt")
# Show any app user ids that have only synced initial data.
plhdata_org_Joy %>% filter(is.na(plhdata_org_Joy$rp.contact.field.first_app_open)) %>% select('app_user_id')
#####Create a subset for an organisation Amathuba####
Organization_Table(data=plhdata_org, Org_name = "Amathuba")
# Create subsets of the data based on organisation Amathuba
#plhdata_org_Amathuba <- filter(plhdata_org, Org == "Amathuba")
# Show any app user ids that are invalid and do not come from the app.
#plhdata_org_Amathuba %>% filter(is.na(plhdata_org_Amathuba$'app_version')) %>% select('app_user_id')
# Create subsets of the data based on valid Joy app user ID's
#plhdata_org_Amathuba <- filter(plhdata_org_Amathuba, !is.na(plhdata_org_Amathuba$'app_version'))
# Show the summary of app versions
#sjmisc::frq(x=plhdata_org_Amathuba$'app_version', out="txt")
# Show any app user ids that have only synced initial data.
plhdata_org_Amathuba %>% filter(is.na(plhdata_org_Amathuba$rp.contact.field.first_app_open)) %>% select('app_user_id')
#Workshop started & completed analysis
# Show the summary of Self care workshop started(1st Workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_started, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#plhdata_org_clean%>%dplyr::filter(Nontobeko,Joy,Amathuba,Dlalanathi)%>%sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_started, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Self care workshop completion(1st Workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of One-on-One Time started(2nd Workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_1on1_started , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of One-on-One Time completion(2nd Workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_1on1_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Praise started(3rd workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_praise_started , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Praise(3rd Workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_praise_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
## Show the summary of Positive Instructions(4th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_instruct_started , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Positive Instructions(4th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_instruct_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Managing Stress(5th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_stress_started , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Managing Stress(5th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_stress_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Family Budgets(6th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_money_started , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# Show the summary of Family Budgets(6th workshop)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_money_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Baseline survey
# Show the summary of baseline survey completion
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_completed , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Descriptive statistics
#Show the summary of user gender
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.user_gender, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Show the summary of user age
plhdata_org_clean$rp.contact.field.user_age <- as.numeric(plhdata_org_clean$rp.contact.field.user_age)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.user_age, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#show the summary , household adults
plhdata_org_clean$rp.contact.field.household_adults <- as.numeric(plhdata_org_clean$rp.contact.field.household_adults)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.household_adults, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#show the summary of , household teens
plhdata_org_clean$rp.contact.field.household_teens <- as.numeric(plhdata_org_clean$rp.contact.field.household_teens)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.household_teens, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#show the summary of , household babies
plhdata_org_clean$rp.contact.field.household_babies <- as.numeric(plhdata_org_clean$rp.contact.field.household_babies)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.household_babies, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#show the summary of , household children
plhdata_org_clean$rp.contact.field.household_children <- as.numeric(plhdata_org_clean$rp.contact.field.household_children)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.household_children, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#show the summary of app versions, language
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org%>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field._app_language, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field._app_language")
#Time spent on the workshops.
#Self care workshop
plhdata_org_clean$rp.contact.field.w_1on1_diff_started_completed <- as.numeric(plhdata_org_clean$rp.contact.field.w_1on1_diff_started_completed)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_diff_started_completed, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#One on one time workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_1on1_diff_started_completed, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Parent Points
##Show summary for each Parent Point, all time number of clicks - for each user
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
#HABIT: Relax
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_relax, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_relax")
# Replaced by above
# plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.parent_point_count_relax")
# plhdata_org_DLALANATHI %>% select('app_user_id', "rp.contact.field.parent_point_count_relax")
# plhdata_org_Joy %>% select('app_user_id', "rp.contact.field.parent_point_count_relax")
# plhdata_org_HILLCREST %>% select('app_user_id', "rp.contact.field.parent_point_count_relax")
#HABIT: Treat yourself well
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_treat_yourself, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_treat_yourself")
#HABIT: Praise yourself
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_yourself, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_praise_yourself")
#HABIT:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_spend_time, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_spend_time")
#HABIT:Praise your teen
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_teen, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_praise_teen")
#HABIT:Get Positive
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_instruct_positively, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_instruct_positively")
#HABIT:Breathe not yell
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_breathe, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_breathe")
#HABIT:Good money choice
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_money, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_money")
#HABIT:Calm consequence
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_consequence, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_consequence")
#HABIT:Safe
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_safe, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_safe")
##Show the summary for each parent point and each week, number of clicks in that week for each user.
#HABIT:Relax WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_relax_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_relax_w_self_care")
#Replaced by above
#plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.parent_point_count_relax_w_self_care")
#plhdata_org_DLALANATHI %>% select('app_user_id', "rp.contact.field.parent_point_count_relax_w_self_care")
#plhdata_org_Joy %>% select('app_user_id', "rp.contact.field.parent_point_count_relax_w_self_care")
#plhdata_org_HILLCREST %>% select('app_user_id', "rp.contact.field.parent_point_count_relax_w_self_care")
#HABIT:Treat yourself well WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_treat_yourself_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_treat_yourself_w_self_care")
#HABIT:Praise yourself well WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_yourself_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_praise_yourself_w_self_care")
#HABIT:One-on-one time WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_spend_time_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_spend_time_w_self_care")
#HABIT:Praise your teen WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_teen_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_praise_teen_w_self_care")
#HABIT:Breathe not yell WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_breathe_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_breathe_w_self_care")
#HABIT:Good Money Choice WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_money_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_money_w_self_care")
#HABIT:Calm Consequence WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_consequence_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_consequence_w_self_care")
#HABIT:Safe WORKSHOP:Self Care
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_safe_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_safe_w_self_care")
#HABIT:Relax WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_relax_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_relax_w_1on1")
#HABIT:Treat yourself well WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_treat_yourself_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_treat_yourself_w_1on1")
#HABIT:Praise yourself well WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_yourself_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_treat_yourself_w_1on1")
#HABIT:One-on-one time WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_spend_time_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_spend_time_w_1on1")
#HABIT:Praise your teen WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_praise_teen_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_praise_teen_w_1on1")
#HABIT:Breathe not yell WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_breathe_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_breathe_w_1on1")
#HABIT:Good Money Choice WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_money_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_money_w_1on1")
#HABIT:Calm Consequence WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_consequence_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_consequence_w_1on1")
#HABIT:Safe WORKSHOP:One-on-one time
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.parent_point_count_safe_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.parent_point_count_safe_w_1on1")
## Show any app user ids that have only synced initial data [Not working as expected]
# sjPlot::sjtab(data=plhdata_org_clean, Org, is.na(rp.contact.field.first_app_open), show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
# user_id_print("rp.contact.field.first_app_open")
#Workshop completion level
#show the summary of total number of activities viewed out of total number of workshop activities (steppers)#####
#percentage corresponding to the proportion the proportion out of the 9 items of the stepper. For example, 4/9 =0.4444444 = 45.
#which is the best way to identify the number of steppers for each workshop?###
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
#(Welcome and Self-Care Workshop)
#change column names to numeric
plhdata_org_clean$rp.contact.field.w_self_care_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_self_care_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_self_care_completion_level")
#Replaced by above
#Show app user ids and their completion levels(Selfcare):NONTOBEKO
#plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.w_self_care_completion_level")
#Show app user ids and whether their completion levels(Selfcare):DLALANATHI
#plhdata_org_DLALANATHI %>% select('app_user_id', "rp.contact.field.w_self_care_completion_level")
#Show app user ids and whether their completion levels(Selfcare):JOY
#plhdata_org_JOY %>% select('app_user_id', "rp.contact.field.w_self_care_completion_level")
#One-on-One Time
plhdata_org_clean$rp.contact.field.w_1on1_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_1on1_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_1on1_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_1on1_completion_level")
#Praise
plhdata_org_clean$rp.contact.field.w_praise_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_praise_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_praise_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_praise_completion_level")
#Positive Instructions
plhdata_org_clean$rp.contact.field.w_instruct_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_instruct_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_instruct_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_instruct_completion_level")
#Managing Stress
plhdata_org_clean$rp.contact.field.w_stress_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_stress_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_stress_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_stress_completion_level")
#Family Budgets
plhdata_org_clean$rp.contact.field.w_money_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_money_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_money_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_money_completion_level")
#Rules
plhdata_org_clean$rp.contact.field.w_safe_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_safe_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_safe_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_safe_completion_level")
#Calm Consequences
plhdata_org_clean$rp.contact.field.w_consequence_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_consequence_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_consequence_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_consequence_completion_level")
#Problem Solving
plhdata_org_clean$rp.contact.field.w_solve_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_solve_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_solve_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_solve_completion_level")
#Teen Safety
plhdata_org_clean$rp.contact.field.w_safe_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_safe_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_safe_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_safe_completion_level")
#Dealing with Crisis
plhdata_org_clean$rp.contact.field.w_crisis_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_crisis_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_crisis_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_crisis_completion_level")
#Celebration and Next Steps
plhdata_org_clean$rp.contact.field.w_celebrate_completion_level <- as.numeric(plhdata_org_clean$rp.contact.field.w_celebrate_completion_level)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_celebrate_completion_level, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.w_celebrate_completion_level")
##Response to each survey question (respond, skip, exit)
#Question: how to find average number "no value" responses to survey questions per org
#Days attention past week
# Show the summary of survey_welcome_a_1_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_1_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_1_final")
# Days of praise past week
# Show the summary of survey_welcome_a_2_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_2_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_2_final")
#Days of stress past week
# Show the summary of survey_welcome_a_3_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_3_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_3_final")
#Days of shouting past week
# Show the summary of survey_welcome_a_4_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_4_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_4_final")
#Days of money worry past week
# Show the summary of survey_welcome_a_5_part_1_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_5_part_1_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_5_part_1_final")
# Show the summary of survey_welcome_a_5_part_2_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_5_part_2_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_5_part_2_final")
#Days of hitting past week
# Show the summary of survey_welcome_a_6_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_6_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_6_final")
# Knowledge of teen activity past week
# Show the summary of survey_welcome_a_7_part_1_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_7_part_1_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_7_part_1_final")
# iff "7" to 7.1: Lockdown? yes/no
# Show the summary of survey_welcome_a_7_part_2_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_7_part_2_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_7_part_2_final")
#iff "7" to 7.1: Knowledge of teen activity in non-lockdown week
# Show the summary of survey_welcome_a_7_part_3_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_7_part_3_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_7_part_3_final")
#Days of sexual safety talk past month
# Show the summary of survey_welcome_a_8_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_8_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_8_final")
#Days of teen COVID safe past week
# Show the summary of survey_welcome_a_9_final
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.survey_welcome_a_9_final, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.survey_welcome_a_9_final")
##Parent Library###
#Show the summary of number of times users access the Parent Library(Number of clicks on the Parent Library tile on the home screen)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_centre_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_hs_parent_centre_count")
#Show the summary of type of content accessed (Number of clicks on any button on the Parent Library page)
#Help
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_help_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_help_count")
#My Tips
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_my_tips_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_my_tips_count")
#Essential Tools
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_essential_tools_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_esential_tools_count")
#COVID
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_covid_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_covid_count")
#Customise
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_customisation_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_customisation_count")
#Relax and Activities
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_relax_and_activities_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_relax_and_activities_count")
#Support Contacts
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_support_contacts_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_support_contacts_count")
#Evidence Base
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_evidence_base_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_evidence_base_count")
#Technical Support
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_technical_support_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_technical_support_count")
#Message Archive
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_pc_message_archive_count, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_pc_message_archive_count")
###Completion status of baseline survey
# Show the summary of baseline survey completion(Organisaton-wise)
sjmisc::frq(x=plhdata_org_NONTOBEKO$rp.contact.field.survey_welcome_completed, out="txt")
sjmisc::frq(x=plhdata_org_JOY$rp.contact.field.survey_welcome_completed, out="txt")
sjmisc::frq(x=plhdata_org_HILLCREST$rp.contact.field.survey_welcome_completed, out="txt")
sjmisc::frq(x=plhdata_org_DLALANATHI$rp.contact.field.survey_welcome_completed, out="txt")
# Show the summary of user ids on baseline survey completion (Organisaton-wise)
user_id_print("rp.contact.field.survey_welcome_completed")
#In-app reminders(Number of in-app message clicks per workshop week),Per quick start button, per workshop week
user_id_print <- function(data = plhdata_org_clean, field) {
for (o in unique(data$Org)) {
# print organisation first
print(o)
# print filtered data
print(
data %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
plhdata_org_clean$hsqsclickedws1<-is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_w_self_care)
sjPlot::sjtab(data=plhdata_org_clean, Org, hsqsclickedws1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print(data =plhdata_org_DLALANATHI, field = "rp.contact.field.click_hs_weekly_workshops_quick_start_w_self_care")
plhdata_org_clean$hsqsclickedws2<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_w_1on1)
sjPlot::sjtab(data=plhdata_org_clean, Org, hsqsclickedws2, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Test 1
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
#plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care")
user_id_print("Org")
#plhdata_org_clean$hsqsclickedws1<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care)
plhdata_org_clean$hsqsclickedcountws1<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care)
#sjPlot::sjtab(data=plhdata_org_clean, Org, hsqsclickedws1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
sjPlot::sjtab(data=plhdata_org_clean, Org,hsqsclickedcountws1 , show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
user_id_print("rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care")
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care")
plhdata_org_clean$hsqsclickedws2<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_w_1on1)
sjPlot::sjtab(data=plhdata_org_clean, Org, hsqsclickedws2, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#Test 2 Priority 22 (how to interpret data?)
#Number of in-app message clicks per workshop week.Per quick start button, per workshop week
#Workshops
#Self Care workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#replaced by above(contact field is non-existent-removed count)
#sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_count_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#In-app reminders(Number of in-app message clicks per workshop week),Per quick start button, per workshop week
plhdata_org_clean$hsqsclickedws1<-!is.na(plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_w_self_care)
sjPlot::sjtab(data=plhdata_org_clean, Org, hsqsclickedws1, show.summary=FALSE, digits=0, fun="xtab", title="", string.total="Total")
#One-on-one time workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Praise
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_praise, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Positive Instructions
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_instruct, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Managing Stress
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_stress, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Family Budgets
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_money, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Rules
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_rules, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Calm Consequence
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_consequence, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Problem Solving
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_solve, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Teen Safety
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_safe, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Dealing with crisis(how to interpret:could mean that people have not interacted with the app)
# sjPlot::sjtab(data=plhdata_org_clean,
# Org,
# rp.contact.field.click_hs_weekly_workshops_quick_start_w_crisis,
# show.summary=FALSE,
# digits=0, fun="xtab",
# title="",
# string,
# total="Total")
table(plhdata_org_clean$Org,plhdata_org_clean$rp.contact.field.click_hs_weekly_workshops_quick_start_w_crisis)
#Celebration and Next Steps
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_w_celebrate, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Parent center
#Self Care workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_centre_quick_start_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#One-on-one time workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_centre_quick_start_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Parent points
#Self Care workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_points_quick_start_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#One-on-one time workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_points_quick_start_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Priority 23
#In-app reminders
#Total number of in-app message clicks.By User
#Weekly workshops
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_weekly_workshops_quick_start_count, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Parent center
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_centre_quick_start_count, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Parent points
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.click_hs_parent_points_quick_start_count, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Priority 19
#App-opens
#Total number of app-opens for each user(cumulative)
#cabrine <- plhdata_org_clean
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
plhdata_org_clean$rp.contact.field.app_launch_count <- as.numeric(plhdata_org_clean$rp.contact.field.app_launch_count)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.app_launch_count, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
user_id_print("rp.contact.field.app_launch_count")
##Priority 20
#App-opens
#Number of app opens within a workshop week for each user
#Self Care Workshop
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.app_launch_count_w_self_care, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
user_id_print("rp.contact.field.app_launch_count_w_self_care")
#One-on-one time workshop
user_id_print <- function(field) {
for (o in orgs_list) {
# print organisation first
print(o)
# print filtered data
print(
plhdata_org %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.app_launch_count_w_1on1, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
user_id_print("rp.contact.field.app_launch_count_w_1on1")
#Rules workshop 7
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.app_launch_count_w_rules, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Calm Consequences workshop 8
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.app_launch_count_w_consequence, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
##Priority 21
#App-opens
#Maximum time between app-opens - for each user.Time in full days
plhdata_org_clean$rp.contact.field.max_days_between_app_launches <- as.numeric(plhdata_org_clean$rp.contact.field.max_days_between_app_launches)
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.max_days_between_app_launches, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Priority 36
#Emotional Check-in
#Rate of users who respond “happy” ,"sad" & "ok"
#Self Care Workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_self_care_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#One on one time workshop
user_id_print <- function(data = plhdata_org_clean, field) {
for (o in unique(data$Org)) {
# print organisation first
print(o)
# print filtered data
print(
data %>%
filter(Org == o) %>%
select('app_user_id', field)
)
}
}
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_1on1_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
user_id_print(data =plhdata_org_DLALANATHI, field = "rp.contact.field.w_1on1_welcome_individual_a_final")
#Praise Workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_praise_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Positive Instructions Workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_instruct_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Managing Stress Workshop
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_stress_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Family Budgets
sjPlot::sjtab(data=plhdata_org_clean, Org, rp.contact.field.w_money_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
#Rules
sjPlot::sjtab(data=plhdata_org_clean, Organisation, rp.contact.field.w_rules_welcome_individual_a_final, show.summary=FALSE, digits=0, fun="xtab", title="",string.total="Total")
# Show app user ids and whether they have completed selfcare.
plhdata_org_Joy %>% select('app_user_id', "rp.contact.field.w_self_care_completed")
# Show app user ids and whether they have started selfcare.
plhdata_org_Joy %>% select('app_user_id', "rp.contact.field.w_self_care_started")
# Show app user ids and whether they have started One-on-One time
plhdata_org_Joy %>% select('app_user_id', "rp.contact.field.w_1on1_started")
#####Completion rate of introductory session(Workshop 1:Selfcare)####
# Show the summary of self care completion
sjmisc::frq(x=plhdata_org_NONTOBEKO$rp.contact.field.w_self_care_completed, out="txt")
# Show app user ids and whether they have completed selfcare.
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.w_self_care_completed")
# Show app user ids and whether they have started selfcare.
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.w_self_care_started")
# Show app user ids and whether they have started one-on-one time
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.w_1on1_started")
#TODO
#####Completion status of baseline survey####
# Show the summary of baseline survey completion(NONTEBEKOM)
sjmisc::frq(x=plhdata_org_NONTOBEKO$rp.contact.field.survey_welcome_completed, out="txt")
# Show app user ids and whether they have completed the baseline survey.
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.survey_welcome_completed")
# Show the summary of baseline survey completion(JOYN)
sjmisc::frq(x=plhdata_org_JOY$rp.contact.field.survey_welcome_completed, out="txt")
# Show app user ids and whether they have completed the baseline survey
plhdata_org_JOY %>% select('app_user_id', "rp.contact.field.survey_welcome_completed")
# Show the summary of baseline survey completion(HILLCREST)
sjmisc::frq(x=plhdata_org_HILLCREST$rp.contact.field.survey_welcome_completed, out="txt")
# Show app user ids and whether they have completed the baseline survey
plhdata_org_HILLCREST %>% select('app_user_id', "rp.contact.field.survey_welcome_completed")
# Show the summary of baseline survey completion(DLALANATHI)
sjmisc::frq(x=plhdata_org_DLALANATHI$rp.contact.field.survey_welcome_completed, out="txt")
# Show app user ids and whether they have completed the baseline survey
plhdata_org_DLALANATHI %>% select('app_user_id', "rp.contact.field.survey_welcome_completed")
####Response to each survey question (respond, skip, exit)#####
# Days attention past week
# Show the summary of survey_welcome_a_1(NONTEBEKOM)
sjmisc::frq(x=plhdata_org_NONTOBEKO$rp.contact.field.survey_welcome_a_1_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_1
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.survey_welcome_a_1_final")
# Show the summary of survey_welcome_a_1(JOYN)
sjmisc::frq(x=plhdata_org_JOY$rp.contact.field.survey_welcome_a_1_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_1
plhdata_org_JOY %>% select('app_user_id', "rp.contact.field.survey_welcome_a_1_final")
# Show the summary of survey_welcome_a_1(DLALANATHI)
sjmisc::frq(x=plhdata_org_DLALANATHI$rp.contact.field.survey_welcome_a_1_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_1
plhdata_org_DLALANATHI %>% select('app_user_id', "rp.contact.field.survey_welcome_a_1_final")
# Show the summary of survey_welcome_a_1(HILLCREST)
sjmisc::frq(x=plhdata_org_HILLCREST$rp.contact.field.survey_welcome_a_1_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_1
plhdata_org_HILLCREST %>% select('app_user_id', "rp.contact.field.survey_welcome_a_1_final")
# Days of praise past week
# Show the summary of survey_welcome_a_2_final(NONTEBEKOM)
sjmisc::frq(x=plhdata_org_NONTOBEKO$rp.contact.field.survey_welcome_a_2_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_2_final
plhdata_org_NONTOBEKO %>% select('app_user_id', "rp.contact.field.survey_welcome_a_2_final")
# Show the summary of survey_welcome_a_2_final(JOYN)
sjmisc::frq(x=plhdata_org_JOY$rp.contact.field.survey_welcome_a_2_final, out="txt")
# Show app user ids and their responses to survey_welcome_a_2_final
plhdata_org_JOY %>% select('app_user_id', "rp.contact.field.survey_welcome_a_2_final")
# Show the summary of survey_welcome_a_2_final(DLALANATHI)
sjmisc::frq(x=plhdata_org_DLALANATHI$rp.contact.field.survey_welcome_a_2_final, out="txt")