Ifeanyi commited on
Commit
b83186b
·
verified ·
1 Parent(s): e8f4a55

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +14 -18
app.R CHANGED
@@ -10,8 +10,6 @@ library(dplyr)
10
  library(reactable)
11
  library(reactablefmtr)
12
 
13
- options(sass.cache = FALSE)
14
-
15
  my_theme <- bs_theme(
16
  bg = "#fdfefe",
17
  fg = "black",
@@ -120,25 +118,25 @@ authorEdges <- reactive({authorPubEdges(
120
  # })
121
 
122
  # pass search output to nodes and edges
123
- nodes_dataset <- reactiveVal(NULL)
124
- edges_dataset <- reactiveVal(NULL)
125
- edges_disp_dataset <- reactiveVal(NULL)
126
-
127
- observeEvent(input$search, {
128
- # compute once and cache
129
- nodes_dataset(authorNodes())
130
- edges_dataset(authorEdges())
131
- edges_disp_dataset(authorEdgesDisp())
132
  })
133
 
 
 
 
 
 
134
  # render data as a reactable output
135
  output$table <- renderReactable({
136
 
137
- req(edges_disp_dataset())
138
-
139
  tryCatch(
140
  {
141
- reactable(edges_disp_dataset(),
142
  theme = reactableTheme(highlightColor = "#b615e7",
143
  borderColor = "#670e94",
144
  borderWidth = 3),
@@ -164,8 +162,7 @@ output$down_nodes <- downloadHandler(
164
  paste("Nodes.csv", sep = "")
165
  },
166
  content = function(file) {
167
- req(nodes_dataset())
168
- fwrite(nodes_dataset(),file)
169
  }
170
  )
171
 
@@ -174,8 +171,7 @@ output$down_edges <- downloadHandler(
174
  paste("Edges.csv", sep = "")
175
  },
176
  content = function(file) {
177
- req(edges_dataset())
178
- fwrite(edges_dataset(), file)
179
  }
180
  )
181
 
 
10
  library(reactable)
11
  library(reactablefmtr)
12
 
 
 
13
  my_theme <- bs_theme(
14
  bg = "#fdfefe",
15
  fg = "black",
 
118
  # })
119
 
120
  # pass search output to nodes and edges
121
+ nodes_df <- eventReactive(input$search,{
122
+ authorNodes()
123
+ })
124
+
125
+ edges_df <- eventReactive(input$search,{
126
+ authorEdges()
 
 
 
127
  })
128
 
129
+ edges_disp <- eventReactive(input$search,{
130
+ authorEdgesDisp()
131
+ })
132
+
133
+
134
  # render data as a reactable output
135
  output$table <- renderReactable({
136
 
 
 
137
  tryCatch(
138
  {
139
+ reactable(edges_disp(),
140
  theme = reactableTheme(highlightColor = "#b615e7",
141
  borderColor = "#670e94",
142
  borderWidth = 3),
 
162
  paste("Nodes.csv", sep = "")
163
  },
164
  content = function(file) {
165
+ fwrite(nodes_df(),file)
 
166
  }
167
  )
168
 
 
171
  paste("Edges.csv", sep = "")
172
  },
173
  content = function(file) {
174
+ fwrite(edges_df(), file)
 
175
  }
176
  )
177