-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_flex.Rmd
110 lines (80 loc) · 2.93 KB
/
test_flex.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
---
title: "Test Flex"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(rlang)
#library(DT)
library(vedar)
library(igraph)
library(networkD3)
library(readxl)
source("./src/graph_functions.R")
sn_h <- 600
sn_w <- 1000
```
```{r, include=FALSE}
#load data
demos_007_vdt <- read.csv("demos_007_vdt.csv")
```
Inputs {.sidebar}
-----------------------------------------------------------------------
```{r}
process_list <- sort(unique(demos_007_vdt$process_description))
selectInput("process_select", "Process",
selected = process_list[1],
process_list,
multiple = F)
region_list <- sort(unique(demos_007_vdt$region))
selectInput("region_select", "Region",
selected = region_list[2],
region_list,
multiple = F)
selectInput("order_select", "N connections",
seq(1,3))
```
This dashboard presents maps of the reference energy system for the demos_007 data. It enables the visualisation of the RES around a process ("node") for "N connection" steps around the process.
**Usage**
* Select a process and region from the dropdowns to render map and relevant data
* Select the number of connection steps to include in the map
* The maps are read from left to right. Processes are shown as nodes. The commodities that flow between the processes are identified by pop-up on the links between the processes. In some datasets, nodes with suffixes `_start_process`, `_end_process` appear. These do not represent a physical processes and are only required for visualisation/modelling purposes.
* An individual process may appear in several maps due to overlaps/
* The process nodes in maps can be rearranged in the vertical plane.
Row {data-height=800}
-----------------------------------------------------------------------
### Map
```{r}
#subset graph to sector of interest
g <- reactive({
make_graph_from_veda_df(demos_007_vdt %>%
filter(
region ==
input$region_select),
input_data_type = "vdt")
})
subgraph_select <- reactive({
#make ego graph returns a list of the order connections from node
g_in <- make_ego_graph(g(),
order = input$order_select,
nodes = input$process_select,
#to return the graph, take [[1]]
mode = "in")[[1]]
g_out <- make_ego_graph(g(),
order = input$order_select,
nodes = input$process_select,
#to return the graph, take [[1]]
mode = "out")[[1]]
combine_graphs(list(g_in, g_out))
})
renderSankeyNetwork({
make_res_from_graph(subgraph_select(),
sankey_width = sn_w,
sankey_height = sn_h)
})
```