-
Notifications
You must be signed in to change notification settings - Fork 4
/
ui.R
1240 lines (872 loc) · 61 KB
/
ui.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
library(shiny)
library(shinythemes)
library(rhandsontable)
suppressMessages(library(SOMbrero))
library(cluster)
library(rhandsontable)
library(Hmisc)
library(GGally)
library(network)
library(sna)
library(ggplot2)
library(igraph)
library(intergraph)
library(tibble)
library(tidyr)
library(tidyverse)
library(shiny)
library(shinyjs)
library(visNetwork)
library(shinyalert)
library(htmltools)
library(crayon)
library(shinydashboard)
library(zip)
library(rintrojs)
library(fresh)
library(plotly)
library(DT)
library(shinycssloaders)
suppressMessages(library(SOMbrero))
library(cluster)
library(rhandsontable)
library(Hmisc)
library(GGally)
library(network)
library(sna)
library(ggplot2)
library(igraph)
library(intergraph)
library(tibble)
library(tidyr)
library(tidyverse)
library(shiny)
library(shinyjs)
library(visNetwork)
library(shinyalert)
library(htmltools)
library(crayon)
library(shinydashboard)
library(zip)
library(rintrojs)
library(plotly)
library(DT)
library(fresh)
library(plotly)
library(shinycssloaders)
library(shinyBS)
library(ggfittext)
mytheme <- create_theme(
adminlte_color(
light_blue = "#bce7fa"
),
adminlte_sidebar(
width = "400px",
dark_bg = "#FFFFFF",
dark_hover_bg = "#EEEEEE",
dark_color = "#000000",
dark_hover_color = "#000000",
dark_submenu_color = "#000000",
dark_submenu_hover_color = "#000000"
),
adminlte_global(
content_bg = "#FAFAFA",
box_bg = "#FFFFFF",
info_box_bg = "#FFFFFF"
)
)
options(spinner.type = 1, spinner.color = "#bce7fa", size = 2)
# here is the first option using shiny themes:
ui <- dashboardPage(
dashboardHeader(
title = 'COMPLEX-IT 1.0.1 Beta',
titleWidth = 375),
dashboardSidebar(
tags$style(HTML(".main-sidebar .sidebar .sidebar-menu .treeview-menu li.active a {background-color: #FFFFFF !important;}")),
tags$style(HTML(".main-sidebar .sidebar .sidebar-menu .treeview-menu li:hover a {background-color: #EEEEEE !important;}")),
width = 375,
sidebarMenu(
HTML('<img src="Complexit_LOGO4.jpg" style="margin-bottom: 20px;margin-top: 10px; display: block; margin-left: auto; margin-right: auto;">'),
id = 'tabs',
menuItem("Import Your Cases and Map Your Theory",
menuSubItem("Import Cases and Map Theory", tabName = "importing")
),
menuItem("Build, Confirm and Explore Your Model",
menuSubItem("Cluster Your Cases", tabName = "cluster_cases"),
menuSubItem("Use AI to Confirm Clusters", tabName = "AI_clusters"),
menuSubItem("Compare and Visualise Your Results", tabName = "compare_and_visualise")
),
menuItem("Run Scenario Simulations",
menuSubItem("Simulate Your Scenarios, Policies, or Interventions", tabName = "scenarios")
),
menuItem("Forecast New Data",
menuSubItem("Use AI to Predict the Cluster Membership of New Cases", tabName = "forecasting")
),
menuItem("Explore Systems Map",
menuSubItem("Use Systems Mapping to Explore Cluster Variables", tabName = "systems_mapping")
),
menuItem("Export Your Results",
menuSubItem("Generate Your Report", tabName = "generate_report")
),
menuItem("Help",
menuSubItem("Help Using COMPLEX-IT", tabName = "help")
)
)
),
dashboardBody(
useShinyjs(),
use_theme(mytheme),
tags$head(tags$style(HTML('
.box {margin-top: 2px;margin-left: 0px; margin-right: 0px; margin-bottom:2px;padding:-10px}'
))),
tags$head(tags$style(HTML('
.skin-blue .main-header .navbar .sidebar-toggle {
color: #000000;
}
'))),
tags$head(tags$style(HTML('
.skin-blue .main-header .logo {
color: #000000;
}
'))),
# tags$style("#varchoice ~ .selectize-control .select-input {
# max-height: 150px;
# overflow-y: auto;
# }"),
# tags$head(
# tags$style(HTML("#trainnotice_advanced_trigger {text-align: center;}"))),
#
# tags$head(
# tags$style(HTML("#trainnotice_advanced_info {text-align: center;}"))),
# tags$head(
# tags$style(HTML("#kmeans_title {text-align: center;}"))),
tags$style(HTML(".full-width-button { width: 100%; }")),
tags$style("
#varchoice ~ .selectize-control .selectize-input {
max-height: 100px;
overflow-y: auto;
}
"),
introjsUI(),
tabItems(
##### IMPORT TAB #####
tabItem("importing",
tags$h3("STEP 1: IMPORT YOUR DATABASE AND MAP YOUR THEORY", style = "text-align: center;"),
tags$h4(HTML("Here you will upload your data. You can also create a conceptual systems map with of your data with PRSM."), style = "text-align: center;"),
p(HTML('For TUTORIALS on preparing and importing your data for COMPLEX-IT and using the PRSM systems mapping tab <a href=
"https://www.art-sciencefactory.com/tutorials.html"
target="_blank">CLICK HERE</a>'), style = "text-align: center;"),
p(HTML('Your data must be in the form of a csv file. For more on creating csv files <a href=
"https://www.wikihow.com/Create-a-CSV-File"
target="_blank">CLICK HERE</a>'), style = "text-align: center;"),
br(),
bsCollapse(open="Import Your Data",
bsCollapsePanel("Import Your Data",
div(
style = "height: 50vh",
fluidRow(
column(3,
box(width = 12,
fileInput('file1', 'Choose CSV File', buttonLabel='Browse',accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
checkboxInput('header', ' Header?', TRUE),
selectInput('sep', 'Separator:',
c("Comma","Semicolon","Tab","Space"), 'Comma'),
uiOutput("varchoice"),
# numericInput('nrow.preview','Number of rows in the preview:',20, min = 1, max = 100),
# numericInput('ncol.preview', 'Number of columns in the preview:',
# 10,min = 1, max = 100),
helpText("Note: Even if the preview only shows a restricted
number of observations, the map will be based on the full dataset.")
)
),
column(9,
DTOutput("view")
)
)
)
),
bsCollapsePanel("Create a Conceptual Systems Map of Your Data",
tags$h4(HTML("PLEASE SAVE YOUR PRSM FILE BEFORE USING AND OPEN PRSM IN ANOTHER WEB-BROWSER TAB"), style = "text-align: center; color: red"),
br(),
div(
style = "height: 65vh",
fluidRow(
column(width = 12,
tags$iframe(style="border: none; width: 100%; height: 600px",
src = "https://prsm.uk/prsm.html")
)
)
)
)
)
),
##### CLUSTER CASES TAB #####
tabItem("cluster_cases",
tags$h3("STEP 2: CLUSTER YOUR CASES USING K-MEANS", style = "text-align: center;"),
tags$h4(HTML("Here we will use cluster analysis to group your cases based on their different configurations of factors"), style = "text-align: center;"),
br(),
#verbatimTextOutput("kmean_warning"),
fluidRow(
column(3,
box(width = 12,
actionButton(inputId = "init_kmeans", label="Get Clusters", class = "full-width-button",
style = "foreground-color:white;
background-color:darksalmon;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
actionButton("infoButton_kmean", "Info", class = "full-width-button",
style = "margin-bottom: 5px;
margin-top: 5px;"),
#helpText("Select display options."),
#checkboxInput('silhouette', 'Silhouette?'),
#checkboxInput('pseudo_f', 'Pseudo F?'),
numericInput(inputId = "clusters", label = "Select the number of clusters", value = 2, min = 2),
radioButtons("setrandseedkmean", HTML("Do you want to set a seed for reproducible results?"),c("Yes", "No"), selected = "No"),
conditionalPanel("input.setrandseedkmean == 'Yes'",
numericInput("randseedkmean",
HTML("Set a random seed."), sample(1:9999, size= 1),
min = 1, max = 9999))
)
),
column(9, align="center",
tabsetPanel(type = 'tabs',
tabPanel('K-Means Clusters',
uiOutput("kmeans_title"), #title for the table
DTOutput("kmeans_tab")),
tabPanel('Additional Statistics',
textOutput("pseudoF"),
br(),
plotOutput(outputId = "kmeans_silh", inline=TRUE))
)
# uiOutput("kmeans_title"), #title for the table
# tableOutput("kmeans_tab"),
# br(),
# textOutput("pseudoF"),
# br(),
# plotOutput(outputId = "kmeans_silh", inline=TRUE)
)
)
),
##### AI CLUSTERS TAB #####
tabItem("AI_clusters",
tags$h3("STEP 3: USING 'AI' TO CONFIRM YOUR CLUSTER SOLUTION", style = "text-align: center;"),
tags$h4(HTML("Here we will use the Self-Organising Map AI to explore further your k-means cluster solution"), style = "text-align: center;"),
#verbatimTextOutput("som_warning"),
br(),
fluidRow(
column(3,
box(width = 12,
actionButton("trainbutton","Train SOM", class = "full-width-button",
style = "foreground-color:white;
background-color:darksalmon;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
actionButton("infoButton_som", "Info", class = "full-width-button",
style = "margin-bottom: 5px;
margin-top: 5px;"),
h4("Map Dimensions", style = "text-align: center;"),
numericInput("dimx", "Map dimension X:", 5, min= 3, max= 15),
numericInput("dimy", "Map dimension Y:", 5, min= 3, max= 15),
h4("Advanced Options", style = "text-align: center;"),
uiOutput("initproto"),
numericInput("maxit", "Max. iterations:", 500),
uiOutput("scaling"),
numericInput("eps0", "Scaling value for gradient descent", 1,
min= 0.01, step= .01),
radioButtons("setrandseed", HTML("Do you want to set a seed for reproducible results?"),c("Yes", "No"), selected = "No"),
conditionalPanel("input.setrandseed == 'Yes'",
numericInput("randseed",
HTML("Set a random seed."), sample(1:9999, size= 1),
min = 1, max = 9999))
)
),
column(9, align="center",
uiOutput("trainnotice_header"),
br(),
tabsetPanel(type = 'tabs',
tabPanel("Advanced Information",
uiOutput("trainnotice_advanced_trigger"),
uiOutput("trainnotice_advanced_info")
),
tabPanel("SOM Cluster Solution",
h5("NOTE: The SOM Cluster Solution shown here is for its quadrant map
(Default 5X5). This solution can be compared to the k-means solution
for corroboration. It also shows how the SOM clusters are distributed
across its map, which helps to decipher the data visualisation tab.",
style = "text-align: center;"),
numericInput("som_3Dplot_superclusters", "Number of superclusters:", 2,
min = 2, max = 10),
plotOutput(outputId = "som_3Dplot", width = "80%", height = "500px")
),
tabPanel("Mapping SOM Cluster Solution",
h5("NOTE: The SOM Cluster Solution shown here is for its quadrant map
(Default 5X5). This solution can be compared to the k-means solution
for corroboration. It also shows how the SOM clusters are distributed
across its map, which helps to decipher the data visualisation tab.",
style = "text-align: center;"),
numericInput("som_3DMap_superclusters", "Number of superclusters:", 2,
min = 2, max = 10),
plotOutput(outputId = "som_3DMap", width = "80%", height = "500px")
),
)
)
)
),
##### COMPARE AND VISUALISE TAB #####
tabItem("compare_and_visualise",
tags$h3("STEP 4: VISUALISE AND EXPLORE YOUR CLUSTER AND AI SOLUTIONS", style = "text-align: center;"),
tags$h4(HTML("Here we visualize the results of both your k-means and SOM AI cluster solutions"), style = "text-align: center;"),
br(),
fluidRow(
column(3,
selectInput("somplotwhat", "Plot what?",
choices= list("Observations"= "obs",
"Prototypes"= "prototypes"
))
),
column(3,
selectInput("somplottype", "Type of plot:",
choices= c('color',
'barplot',
'names',
'boxplot'))
),
column(3,
conditionalPanel("input.somplottype == 'color' ||
input.somplottype == '3d'",
selectInput("somplotvar",
"Variable:",
choices= "(Not Available)")),
conditionalPanel("input.somplottype == 'names'",
numericInput("names_SC_num",
"Number of superclusters:",
2,
min = 2,
max = 10,
step = 1))
),
column(3,
fluidRow(
column(12,
conditionalPanel("input.trainbutton > 0",
actionButton("save_som", "Save SOM Results", class = "full-width-button")
)
),
column(12,
uiOutput("save_som_notice") # SHOULD SAVE SOM BE IN THE PRIOR TAB?
)
),
fluidRow(
column(12,
actionButton("infoButton_plot_map", "Info", class = "full-width-button")
)
)
)
# column(3,
#
# column(6,
#
# conditionalPanel("input.trainbutton > 0",
# actionButton("save_som", "Save SOM Results")),
#
# uiOutput("save_som_notice") # SHOULD SAVE SOM BE IN THE PRIOR TAB?
#
# ),
#
# column(6,
#
# actionButton("infoButton_plot_map", "Info", class = "full-width-button")
#
# )
# )
),
# conditionalPanel("input.somplottype == 'boxplot'",
# selectInput("somplotvar2",
# "Variable: (hold Ctrl to select
# multiple variables)",
# choices= "(Not Available)",
# multiple= TRUE)),
column(12, align="center",
conditionalPanel(
condition = "input.somplottype == 'boxplot'",
withSpinner(plotlyOutput("somplot_box", height = "600px")) #, width = "1000px"
),
conditionalPanel(
condition = "input.somplottype == 'names'",
withSpinner(plotOutput("somplot_names", height = "600px"))
),
conditionalPanel(
condition = "input.somplottype == 'color'",
withSpinner(plotOutput("somplot_color", height = "600px"))
),
conditionalPanel(
condition = "input.somplotwhat == 'obs' && input.somplottype == 'barplot'",
withSpinner(plotlyOutput("somplot_obs_bar", height = "600px"))
),
conditionalPanel(
condition = "input.somplotwhat == 'prototypes' && input.somplottype == '3d'",
withSpinner(plotlyOutput("somplot_3d", height = "600px"))
),
conditionalPanel(
condition = "input.somplotwhat == 'prototypes' && input.somplottype == 'smooth.dist'",
withSpinner(plotlyOutput("somplot_smooth_dist", height = "600px"))
),
conditionalPanel(
condition = "input.somplotwhat == 'prototypes' && input.somplottype == 'barplot'",
withSpinner(plotlyOutput("somplot_prototypes_bar", height = "600px"))
),
conditionalPanel(
condition = "input.somplotwhat == 'prototypes' && input.somplottype == 'umatrix'",
withSpinner(plotOutput("somplot_umatrix", height = "600px"))
)
# conditionalPanel(
# condition = "input.somplotwhat == 'prototypes' && input.somplottype == 'grid'",
# withSpinner(plotlyOutput("somplot_grid", height = "600px"))
# )
)
),
##### SCENARIOS TAB #####
tabItem("scenarios",
tags$h3("STEP 5: USING YOUR THEORY/MODEL TO RUN SCENARIO SIMULATIONS", style = "text-align: center;"),
tags$h4("Here we will use your model to explore different scenarios, policies, and interventions", style = "text-align: center;"),
tags$h4("To do that, we will be using your k-means clusters and your SOM AI solution and grid.", style = "text-align: center;"),
br(),
#verbatimTextOutput("Agent_Warning"),
fluidRow(
column(3,
box(width = 12,
actionButton("infoButton_scenarios", "Info", class = "full-width-button",
style = "margin-bottom: 5px;
margin-top: 5px;"),
h4("Run Model", style = "text-align: center;"),
actionButton(inputId = "Agent_Setup", label="Model Setup", class = "full-width-button",
style = "foreground-color:white;
background-color:khaki;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
actionButton(inputId = "Agent_Run_Clusters", label="Run Clusters", class = "full-width-button",
style = "foreground-color:white;
background-color:lavender;
color:black;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 20px;
margin-top: 5px;"),
h4("Sensitivity Analysis", style = "text-align: center;"),
actionButton(inputId = "SensitivityAnalysis", label="Sensitivity", class = "full-width-button",
style = "foreground-color:white;
background-color:darksalmon;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
uiOutput('cluster_sensitivity')
),
),
column(9,
conditionalPanel("input.Agent_Setup > 0",
tabsetPanel(type = 'tabs',
tabPanel('SOM Plot Grid',
plotOutput("somplotagent", width ="700px", height = "600px"),
br(),
rHandsontableOutput("clusters_editable_table"),
actionButton("back_cluster", "<<"),
actionButton("forward_cluster", ">>")),
tabPanel('Sensitivity Bar Plot', plotOutput("sensitivity_barplot")),
tabPanel('Agent SOM Plot', plotOutput("agent_somplot"))
)
) #Could comment this out so it by default shows the options
))
),
##### FORECASTING TAB #####
tabItem("forecasting",
tags$h3("STEP 6: USE YOUR RESULTS TO PREDICT THE CLUSTER MEMBERSHIP OF NEW CASES", style = "text-align: center;"),
tags$h4(HTML("Here we will use your trained SOM GRID (TAB 4) to predict the cluster profile(s) that best represent a new set of cases"), style = "text-align: center;"),
#verbatimTextOutput("Predict_Warning"),
br(),
fluidRow(
column(3,
box(width = 12,
actionButton(inputId = "classify_prof", label="Classify Profiles", class = "full-width-button",
style = "foreground-color:white;
background-color:darksalmon;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
actionButton("infoButton_new_prediction", "Info", class = "full-width-button",
style = "margin-bottom: 5px;
margin-top: 5px;"),
fileInput('file_pred', 'Choose CSV File', accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")),
selectInput('sep_pred', 'Separator:',
c("Comma","Semicolon","Tab","Space"), 'Comma'),
checkboxInput('load_prev_som', 'Use Previous SOM Solution? If unchecked it will use SOM solution from this session.'),
#numericInput("nrow.result_pred","Number of rows in the results:" ,20, min = 1, max = 100)
)
),
column(9,
tabsetPanel(type = 'tabs',
tabPanel('Table of Predictions', DTOutput("view_predict")),
tabPanel('Prediction SOM Plot', plotOutput("predict_somplot"))
)
)
)
),
##### SYSTEMS MAPPING TAB #####
tabItem("systems_mapping",
# App title ----
#titlePanel("STEP 8: USING SYSTEMS MAPPING TO EXPLORE CLUSTER VARIABLES"),
tags$h3("STEP 7: USING SYSTEMS MAPPING TO EXPLORE CLUSTER VARIABLES", style = "text-align: center;"),
tags$h4(HTML("Here we will use Systems Mapping to visually explore the configuration of variables you used to cluster your data. <br>
The map is generated using the <a href='https://dictionary.apa.org/zero-order-correlation'>zero-order correlations</a> amongst your variables."), style = "text-align: center;"),
#verbatimTextOutput("network_warning"),
fluidRow(
column(10,
# Output: Histogram ----
introBox(
visNetworkOutput("networkPlot", height = '600px'),
data.step = 25,
data.intro = "Here is your network. You can interact with it, including zooming in and out, moving nodes, and drawing in your own nodes and connections."),
br(),
br(),
br() #Unless a better solution is found, this must be kept at three br() tags, as any less and the footer gets cut off.
),
column(2,
introBox(actionButton(inputId = "initialise_button", label="Initialise Network", class = "full-width-button",
style = "foreground-color:white;
background-color:darksalmon;
color:black;
float:center;
height: 50px;
text-align:center;
border-color:black;
border-radius: 5px;
border-width: 5px;
margin-bottom: 5px;
margin-top: 5px;"),
data.step = 1,
data.intro = "Clicking this button initialises your systems mapping network."
),
introBox(actionButton("infoButton", "Info", class = "full-width-button",
style = "margin-bottom: 5px;
margin-top: 5px;"),
data.step = 2,
data.intro = "Clicking this button lets you re-read the information on the pop-up when first entering the Systems Mapping tab."
),
actionButton("tour_systems_mapping", "Guided Tour of Inputs", class = "full-width-button",
style = "margin-bottom: 20px;
margin-top: 5px;"),
# Input: Node selection
introBox(
selectInput("chosen_node", "Examine node:",
c(NULL),
selected = F),
htmlOutput("text", inline = T),
data.step = 26,
data.intro = "Here you can examine facts about your network and any particular nodes in your network."),
br(),
introBox(
# Size of Nodes
numericInput('node_size', 'Node Size:',
value = 25,
min = 1,
max = 100),
data.step = 27,
data.intro = "Here you can change the size of your nodes."),
)
),
fluidRow(
column(4,
shinyjs::useShinyjs(),
######################## MAIN OPTIONS BOX START ########################
box(id = "intro_box", width = "800px",
introBox(selectInput(inputId = "cluster",
label = "What Cluster would you like to analyse?",
choices = NULL,
selected = 'All',
multiple = FALSE),
data.step = 3,
data.intro = "If you clustered your data using K-Means in tab 2, you can choose to examine any cluster that has more than three members in that cluster."
),
introBox(
# Adding information panel
helpText("For these two sliders, values below the threshold will be
excluded when making the network. For example, setting the correlation threshold
to 0.7 excludes correlations below 0.7 from the network."),
# Input: Slider for minimum correlation ----
sliderInput(inputId = "neg_corr",
label = "Threshold for Negative Correlations:",
min = 0,
max = 1,
value = 0.2,
step = 0.05),
# Input: Slider for maximum correlation ----
sliderInput(inputId = "pos_corr",
label = "Threshold for Positive Correlations:",
min = 0,
max = 1,
value = 0.2,
step = 0.05),
data.step = 4,
data.intro = "Here you can filter for what threshold of positive or negative correlation must be achieved for a connection to be drawn between your nodes."),
introBox(# Adding dropdown to change network ----
selectInput("layout", "Choose layout algorithm:",
c("Circle" = "layout_in_circle",
"Random" = "layout_randomly",
"Davidson-Harel" = "layout_with_dh",
"Fruchterman-Reingold" = "layout_with_fr",
"Sugiyama" = "layout_with_sugiyama"),
selected = T),
data.step = 5,
data.intro = "Here you can choose the layout of your network." ),
introBox(# Adding dropdown to change network ----
radioButtons(inputId = "remove_unconnecteds",
label = "Remove Nodes with No Connections?",
c("No", "Yes")),
data.step = 6,
data.intro = "Here you remove any nodes from your network that do not have links to any other nodes." )),
######################## MAIN OPTIONS BOX START ########################
br(),
br(),
br(),
br()
),
column(4,
shinyjs::useShinyjs(),
######################## ADVANCED OPTIONS CHECKBOX START ########################
box(id = "advancedOptionsBox", title = "Advanced Options", width = "800px",
introBox(
# Choose how to present line thickness
radioButtons(inputId = "LineThickness",
label = "How to Determine Line Thickness",
c("Threshold"="binary", "Gradation"="bins")),
data.step = 8,
data.intro = "Here you decide if you would like your lines to be represented as a threshold of 'stronger' and 'weaker' correlations (default), or a gradation increasingly thicker lines as the correlations get stronger." ),
introBox(
# Adding information panel ----
helpText("Note: the threshold for 'minor' correlations determines at what value
correlations between nodes will have a thinner dashed line or a thicker
solid line. For example, a setting the threshold at 0.5 will designate
correlations below that as 'minor'."),
# Adding slider for when dotted line ----
sliderInput(inputId = "minor_threshold",
label = "Threshold for 'Minor' Correlations:",
min = 0,
max = 1,
value = 0.7,
step = 0.05),
data.step = 9,
data.intro = "If your lines are decided by a threshold, this determines at what value you consider a correlation to be weaker and thus represented with a thinner line." ),
introBox(
numericInput(inputId = "seed",
label = "Set Seed (for reproducible results)",
value = 1,
min = 1,
max = 10000),
data.step = 10,
data.intro = "Here you can set a seed for reproducible results in graphing your network." )
),