Repository navigation
Expand file tree
/
Copy pathcomparisons.R
More file actions
156 lines (126 loc) · 7.51 KB
/
Copy pathcomparisons.R
File metadata and controls
156 lines (126 loc) · 7.51 KB
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
# Server Output Functions for Comparisons Tab
# Make two parallel sets of input and data. Different mapping on each side
# ####### SUBSET A ##########
output$Comparison_Tab_Controls_A1 <- renderUI({
selectizeInput("CompareMapInputID_A",label = h4("Choose POV A:"), get_POV_names() )
})
output$Comparison_Tab_Controls_A2 <- renderUI({
req(input$CompareMapInputID_A)
zoom_limit = zoom_upper_limit(get_POV( input$CompareMapInputID_A))
if (zoom_limit == 1)
{tags$h4("Zooming not available with this mapping")}
else
{sliderInput("CompareZoomID_A",
label=h4("Zoom in and out by event similarity:"),
1,zoom_limit,zoom_limit, step = 1, ticks=FALSE) }
})
# just one type of plot for now -- need to select different plot types
output$Comparison_Plots_A <- renderPlotly({
threadMap(threadedEventsComp_A(), "threadNum", "seqNum", get_Zoom_COMP_A(), 15 )
})
# ####### SUBSET B ##########
output$Comparison_Tab_Controls_B1 <- renderUI({
selectizeInput("CompareMapInputID_B",label = h4("Choose POV B:"), get_POV_names() )
})
output$Comparison_Tab_Controls_B2 <- renderUI({
req(input$CompareMapInputID_B)
zoom_limit = zoom_upper_limit(get_POV( input$CompareMapInputID_B))
if (zoom_limit == 1)
{tags$h4("Zooming not available with this mapping")}
else
{sliderInput("CompareZoomID_B",
label=h4("Zoom in and out by event similarity:"),
1,zoom_limit,zoom_limit, step = 1, ticks=FALSE) }
})
# just one type of plot for now -- need to select different plot types
output$Comparison_Plots_B <- renderPlotly({
threadMap(threadedEventsComp_B(), "threadNum", "seqNum", get_Zoom_COMP_B(), 15 )
})
#### Put all eight here #####
output$Comp_A_1 <- renderPlotly({ threadMap(threadedEventsComp_A(), "threadNum", "seqNum", get_Zoom_COMP_A(), 15 ) })
output$Comp_B_1 <- renderPlotly({ threadMap(threadedEventsComp_B(), "threadNum", "seqNum", get_Zoom_COMP_B(), 15 ) })
output$Comp_A_2 <- renderPlotly({ threadMap(threadedEventsComp_A(), "threadNum", "tStamp", get_Zoom_COMP_A(), 15 ) })
output$Comp_B_2 <- renderPlotly({ threadMap(threadedEventsComp_B(), "threadNum", "tStamp", get_Zoom_COMP_B(), 15 ) })
output$Comp_A_3 <- renderPlotly({ threadMap(threadedEventsComp_A(), "threadNum", "relativeTime", get_Zoom_COMP_A(), 15 ) })
output$Comp_B_3 <- renderPlotly({ threadMap(threadedEventsComp_B(), "threadNum", "relativeTime", get_Zoom_COMP_B(), 15 ) })
output$Comp_A_4_controls <- renderUI({sliderInput("A_4_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE )})
output$Comp_B_4_controls <- renderUI({sliderInput("B_4_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE )})
output$Comp_A_4 <- renderVisNetwork({
req(input$A_4_Theshold)
n = threads_to_network_original( threadedEventsComp_A(), "threadNum", get_Zoom_COMP_A() )
n=filter_network_edges(n,input$A_4_Theshold)
circleVisNetwork( n , 'directed' ) })
output$Comp_B_4 <- renderVisNetwork({
req(input$B_4_Theshold)
n = threads_to_network_original( threadedEventsComp_B(), "threadNum", get_Zoom_COMP_B() )
n=filter_network_edges(n,input$B_4_Theshold)
circleVisNetwork( n , 'directed' ) })
output$Comp_A_5_controls <- renderUI({sliderInput("A_5_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE )})
output$Comp_B_5_controls <- renderUI({sliderInput("B_5_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE )})
output$Comp_A_5 <- renderForceNetwork({
req(input$A_5_Theshold)
n = threads_to_network_original( threadedEventsComp_A(), 'threadNum', get_Zoom_COMP_A(), 'threadNum' )
n = filter_network_edges(n,input$A_5_Theshold)
forceNetworkD3( n ) })
output$Comp_B_5 <- renderForceNetwork({
req(input$B_5_Theshold)
n = threads_to_network_original( threadedEventsComp_B(), 'threadNum', get_Zoom_COMP_B(), 'threadNum' )
n = filter_network_edges(n,input$B_5_Theshold)
forceNetworkD3( n ) })
output$Comp_A_6_controls <- renderUI({button_choices = get_POV_EVENT_CF( input$CompareMapInputID_A)
tags$div(
radioButtons("A_6_OtherNetworkCF","Graph co-occurrence relation between:",
choices = button_choices,
selected = button_choices[1], # always start with the first one
inline=TRUE),
sliderInput("A_6_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE ))})
output$Comp_B_6_controls <- renderUI({button_choices = get_POV_EVENT_CF( input$CompareMapInputID_B )
tags$div(
radioButtons("B_6_OtherNetworkCF","Graph co-occurrence relation between:",
choices = button_choices,
selected = button_choices[1], # always start with the first one
inline=TRUE),
sliderInput("B_6_Theshold","Display edges above", 0,1,0,step=0.01,ticks=FALSE ))})
output$Comp_A_6 <- renderVisNetwork({
req(input$A_6_Theshold)
n = normalNetwork( threadedEventsComp_A(), selectOccFilter(), input$A_6_OtherNetworkCF )
n=filter_network_edges(n,input$A_6_Theshold)
circleVisNetwork( n,'nondirected' ) })
output$Comp_B_6 <- renderVisNetwork({
req(input$B_6_Theshold)
n = normalNetwork( threadedEventsComp_B(), selectOccFilter(), input$B_6_OtherNetworkCF )
n=filter_network_edges(n,input$B_6_Theshold)
circleVisNetwork( n, ,'nondirected' ) })
output$Comp_A_7_controls <- renderUI({checkboxGroupInput("A_7_CFs","Pick Two:", get_POV_EVENT_CF( input$CompareMapInputID_A) )})
output$Comp_B_7_controls <- renderUI({checkboxGroupInput("B_7_CFs","Pick Two:", get_POV_EVENT_CF( input$CompareMapInputID_B) )})
output$Comp_A_7 <- renderPlotly({ role_map( threadedEventsComp_A(), selectOccFilter(), input$A_7_CFs ) })
output$Comp_B_7 <- renderPlotly({ role_map( threadedEventsComp_A(), selectOccFilter(), input$B_7_CFs ) })
output$Comp_A_8 <- renderPlotly({ threadTrajectory(threadedEventsComp_A() ) })
output$Comp_B_8 <- renderPlotly({ threadTrajectory(threadedEventsComp_B() ) })
# ########## DIACHRONIC Comparison sub-tab ###########
output$Diachronic_Comparison_Tab_Controls_1 <- renderUI({
tagList( selectizeInput("DiaCompareMapInputID",label = h4("Choose POV:"), get_POV_names() ),
selectizeInput('comparePanelViz',label = h4('Choose visualization:'),
c('Role Maps','Thread Trajectories','Threads (event time)','Ngrams' ))) })
output$Diachronic_Comparison_Tab_Controls_3 <- renderUI({
tagList(
radioButtons("DiaCompareTimeSubsetID", "How many time intervals to compare:", choices = c(1, 2, 3, 4, 5, 6), selected="1", inline=TRUE),
checkboxGroupInput("role_map_cfs","Pick Two for role map:", get_POV_EVENT_CF( input$DiaCompareMapInputID) ) )
})
# controls for the comparison input panels
# Use all of the column names here...
output$Diachronic_Comparison_Tab_Controls_4 <- renderUI({
selectizeInput("selectComparisonID","Compare by:", get_COMPARISON_CF() ) }) #???
output$Diachronic_Comparison_Tab_Controls_5 <- renderUI({
selectizeInput("selectComparisonGroupsID","Compare specific groups:",
CF_levels(), multiple=TRUE) })
# Get subsets of events and create sub-plots for them
output$DiachronicComparisonPlots <- renderPlotly({
req(input$selectComparisonGroupsID)
Comparison_Plots(threadedEventsDiaComp(),
selectOccFilter(),
input$selectComparisonID,
input$selectComparisonGroupsID,
input$DiaCompareTimeSubsetID,
input$comparePanelViz,
input$role_map_cfs)})