Newer
Older
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
product_list %>% filter(code == "SUNO")
plotList <- function(nplots) {
lapply(seq_len(nplots), function(x) plot_ly())
}
fig <- subplot(p1, p2)
nodes1 = nodes_position(biofuels_ln_baseline[[2]])
links1 = biofuels_ln_baseline[[1]]
links2 <- biofuels_ln[[1]]
nodes2 <- nodes_position(biofuels_ln[[2]])
fig <- plot_ly(
width = 1000,
height = 800,
type = "sankey",
# domain = list(
# x = c(0,1),
# y = c(0,1)
# ),
orientation = "h",
arrangement = 'snap',
valueformat = ".0f",
valuesuffix = " tonnes",
node = list(
label = nodes$label,
color = nodes$color,
x = nodes$level_x,
y= nodes$level_y,
pad = 20,
thickness = 15,
line = list(
color = "blau",
width = 1
)
),
link = list(
source = links$source,
target = links$target,
value = links$value,
color = links$color
#label = links$group
)
) %>% layout(
autosize = F,
margin = list(l=10, r=10, b=50, t=50, pad=40),
title = "Market Balance in Tonnens",
font = list(size = 13, family ="Arial"),
xaxis = list(showgrid = F, zeroline = F),
yaxis = list(showgrid = F, zeroline = F)
)
convert_supply_details(region_list= "EU", product_list= "MAIZ", scenario_list= sanky_file1, folder = gdx.dir)
diff_perc_supply_details <- function(b,s){
diff_all <- bind_rows(b,s) %>%
# evaluate following calls for each value in the rowname column
group_by(Commodities) %>%
# add all non-grouping variables
summarise(across(everything(), diff, .names = "diff_{col}"))
# diff_all
print(diff_all)
percent = data.frame(Commodities = b$Commodities) %>% as_tibble()
for (i in 1:(ncol(s)-1)){
percent <- bind_cols(round(s[i]/b[i] *100-100, 1), percent)
#volumn <- bind_cols(round(sum(oil_cake_market_Scenario[i,1:7]) / sum(oil_cake_market_baseline[i,1:7])*100-100, 1), percent)
}
percent$volume <- NA
for (i in 1:nrow(s)) percent$volume[i] <- (sum(s[i,1:4])/sum(b[i,1:4])*100-100)
all <- full_join(diff_all, percent)
print(all)
}