###########################################################################
###########################################################################
### ###
### Installation: ###
### INSTALL R PACKAGES FROM GITLAB, GITHUB ###
### ###
###########################################################################
###########################################################################
# Install R packages from Gitlab, Github.
# Install the released version of devtools from CRAN:
install.packages("devtools")
# Install the latest version of packages from Github
devtools::install_github("briatte/tidykml")
devtools::install_github("GAMS-dev/gdxrrw/gdxrrw")
# Install the latest version of packages from Gitlab
devtools::install_git("https://git-dmz.thuenen.de/mindstep/caprir.git")
devtools::install_git("https://git-dmz.thuenen.de/mindstep/capriv.git")
# load packages
requiredPackages = c('caprir', 'capriv', 'gdxrrw', 'usethis', 'hablar', 'tibble',
'networkD3', 'readxl', 'tidyr', 'dplyr','reshape2', 'data.table',
'plotly', 'gt', 'ggtext', 'rlang', 'Hmisc', 'webshot')
for(p in requiredPackages){
if(!require(p,character.only = TRUE))install.packages(p)
library(p,character.only = TRUE, quietly = TRUE)}
# set gams path, if necessary
gamsPath <- "D://gams//win64//24.9"
igdx(gamsPath)
# install devtools
install.packages("devtools")
library(devtools)
# install tidykml
devtools::install_github("briatte/tidykml")
library(tidykml)
# install gdxrrw
# 1: download from website: https://support.gams.com/gdxrrw:interfacing_gams_and_r
# 2: install package
install.packages("D:/public/yang/CAPRIR_Project/gdxrrw_1.0.5.zip", repos = NULL, type="source")
# or install from github
devtools::install_github("GAMS-dev/gdxrrw/gdxrrw")
library(gdxrrw)
# install capriR package
# remotes::install_github("trialsolution/caprir", force = TRUE)
devtools::install_git("https://git-dmz.thuenen.de/mindstep/caprir.git")
library(caprir)
devtools::install_git("https://git-dmz.thuenen.de/mindstep/capriv.git",force = TRUE)
library(capriv)
# load packages
requiredPackages = c('caprir','capriv','gdxrrw', 'usethis','hablar', 'tibble',
'networkD3','readxl','tidyr','dplyr','reshape2',
'data.table','plotly', 'gt', 'ggtext', 'rlang', 'Hmisc')
for(p in requiredPackages){
if(!require(p,character.only = TRUE)) install.packages(p)
library(p,character.only = TRUE)}
map_data_use <- caprir::map_data %>%
filter(!grepl("TR.*", CAPRI_NUTS_ID)) %>% # TR: Tuerkiye
filter(!grepl("UK.*", CAPRI_NUTS_ID)) %>%# UK:
filter(!grepl("PT20.*", CAPRI_NUTS_ID)) %>% # PT20/PT30
filter(!grepl("PT30.*", CAPRI_NUTS_ID)) %>%# PT20/PT30
filter(!grepl("ES70.*", CAPRI_NUTS_ID)) # ES70
setwd("D:/public/yang/CAPRIR_Project/capriv")
file1 <- "res_2_1230cap_after_2014_refdefaultA" # refdefautA
file2 <- "res_2_1230fta_import_bandefaultA" # bandefaultA
gamsPath <- "D://gams//win64//24.9"
igdx(gamsPath)
# CERE RAPE SOYA PULS
prod1 = c("CERE","RAPE","SOYA","PULS")
# MAIF OFAR GRAI GRAE
prod2 = c("MAIF", "OFAR","GRAI","GRAE")
prods = c(prod1,prod2)
gdx.dir <- paste0(getwd(), "/inst/extdata/gdx")
# products %>% filter(key %in% prod_list)
outdata.dir <- paste0(getwd(), "/inst/outdata")
# load baseline
benchmark <- capri_data(filename = paste0(gdx.dir,"/",file1),
selregion = "all",
seldim5 = "",
selcols = prods,
selrows = "LEVL" ,
simyear = "2030",
scenarioname = "benchmark")
# load scenario
scenario <- capri_data(filename = paste0(gdx.dir,"/",file2),
selregion = "all",
seldim5 = "",
selcols = prods,
selrows = "LEVL" ,
simyear = "2030",
scenarioname = "scenario")
# prod 1, percent change
p1 <- map_capri(baseline = benchmark, scenario = scenario, prods = prod1, comparison = TRUE, percent_change = TRUE, 11)
# prod 2, percent change
p2 <- map_capri(baseline = benchmark, scenario = scenario, prods = prod2, comparison = TRUE, percent_change = TRUE, 11)
ggsave(paste0( outdata.dir,"/png/cereals.png"), plot = p1,width = 16, height = 9, dpi = 100)
ggsave(paste0( outdata.dir,"/png/MAIF.png"), plot = p2,width = 16, height = 9, dpi = 100)
rm(list=ls())
## Step 0:installation requirements packages
# install devtools
install.packages("devtools")
library(devtools)
# install tidykml
devtools::install_github("briatte/tidykml")
library(tidykml)
# install gdxrrw
# 1: download from website: https://support.gams.com/gdxrrw:interfacing_gams_and_r
# 2: install package
install.packages("D:/public/yang/CAPRIR_Project/gdxrrw_1.0.5.zip", repos = NULL, type="source")
# or install from github
devtools::install_github("GAMS-dev/gdxrrw/gdxrrw")
library(gdxrrw)
# install capriR package
# remotes::install_github("trialsolution/caprir", force = TRUE)
devtools::install_git("https://git-dmz.thuenen.de/mindstep/caprir.git")
library(caprir)
devtools::install_git("https://git-dmz.thuenen.de/mindstep/capriv.git")
library(capriv)
#
# requiredPackages_Github <- c("briatte/tidykml", "GAMS-dev/gdxrrw/gdxrrw")
#
#
# requiredPackages_Gitlab <- "https://git-dmz.thuenen.de/mindstep/caprir.git"
# # "https://git-dmz.thuenen.de/mindstep/capriv.git")
# load packages
requiredPackages = c('caprir','capriv','gdxrrw', 'usethis','hablar', 'tibble',
'networkD3','readxl','tidyr','dplyr','reshape2',
'data.table','plotly', 'gt', 'ggtext', 'rlang', 'Hmisc','webshot')
for(p in requiredPackages){
if(!require(p,character.only = TRUE))install.packages(p)
library(p,character.only = TRUE)}
# set gams path, if necessary
gamsPath <- "D://gams//win64//24.9"
igdx(gamsPath)
# set currently working directory
#setwd("D:/public/yang/CAPRIR_Project/caprir_yang")
gdx.dir <- paste0(getwd(), "/inst/extdata/gdx")
# define gdx file name for reading
sanky_file1 <- "res_2_1230cap_after_2014_refdefaultA" # refdefautA
sanky_file2 <- "res_2_1230fta_import_bandefaultA" # bandefaultA
# loaded gdx files and saved in dataout
outdata.dir <- paste0(getwd(), "/inst/outdata")
prod_list = c("WHEA","MAIZ","BARL","RAPE","SUNF","PULS",
"DDGS","SUGR","ACQU", "SOYC", "OCER","SOYA",
"RAPO","POUM","RAPC","SUNC","BIOE","SOYO",
"RICE", "PULS", "SUGA", "SUNO")
balance_detailed_Baseline <- convert_balance_detailed("EU",
prod_list,
sanky_file1,
folder = gdx.dir)
balance_detailed_Scenario <- convert_balance_detailed("EU",
prod_list,
sanky_file2,
folder = gdx.dir)
# biofuels = T
baseline_biofuels <- prelinks(balance_detailed = balance_detailed_Baseline, p_biofuels = T)
scenario_biofuels <- prelinks(balance_detailed = balance_detailed_Scenario, p_biofuels = T)
# biofuels = F
baseline <- prelinks(balance_detailed = balance_detailed_Baseline, p_biofuels = FALSE)
scenario <- prelinks(balance_detailed = balance_detailed_Scenario, p_biofuels = FALSE)
# get links and nodes for different selected market -------------------
# biofuels, baseline
biofuels_ln_baseline <- links_nodes(baseline_biofuels, scenario_biofuels, p_baseline =TRUE, fixedNodePosition = TRUE)
# biofuels, scenario
biofuels_ln <- links_nodes(baseline_biofuels, scenario_biofuels, p_baseline = FALSE,fixedNodePosition = TRUE)
# others, baseline
ln_baseline <- links_nodes(baseline, scenario, TRUE,fixedNodePosition = TRUE)
# others, scenario
ln <- links_nodes(baseline, scenario, FALSE,fixedNodePosition = TRUE)
# sankey plots ----------------------
# one sankey diagram in one page ----
# biofuels, baseline,
capriv::plot_sankey(biofuels_ln_baseline,
p_baseline = TRUE,
png = FALSE)
# biofuels and scenario
capriv::plot_sankey(biofuels_ln,
p_baseline = FALSE,
png = FALSE)
# cereals, sugar .. and baseline
capriv::plot_sankey(ln_baseline,
p_baseline =TRUE,
png = FALSE) ###
# cereals, sugar .. and scenario
capriv::plot_sankey(ln,
p_baseline = FALSE,
png = FALSE)
# two sankey diagrams in one page ----
# combination two data frames
cake_oil_m <- combine_dfs(biofuels_ln_baseline, biofuels_ln)
capriv::plot_sankey(cake_oil_m,
p_baseline = TRUE,
png = FALSE)
cereals <- combine_dfs(ln_baseline, ln)
capriv::plot_sankey(cereals,
p_baseline = TRUE,
png = TRUE)
# make beautiful tables -----
# oil cake balance market ----
oil_cake_market_list= c("Rape seed",
"Soya seed",
"Sunflower seed",
"Rape seed oil",
"Soya oil",
"Sunflower seed oil",
"Soya cake",
"Sunflowe seed cake",
"Rape seed cake",
"Destilled dried grains from bio-ethanol processing",
"Pulses",
"Bio ethanol")
# basline: load balance market.
b_oil_cake <- filter_market_balance(balance_detailed_Baseline, oil_cake_market_list)
# Scenario: load balance market.
s_oil_cake <- filter_market_balance(balance_detailed_Scenario, oil_cake_market_list)
# calculate the absolute and percentage changes between baseline and scenario.
oil_cake <- cal_percentage_change(b_oil_cake,s_oil_cake)
# make a nice table
oil_cake_tb <- nicetable(oil_cake,"baseline for oil and cake markets") %>%
tab_footnote(
locations = cells_stub(rows = c(2)),
footnote = md("Destilled dried grains from bio-ethanol processing")
)%>%
gtsave(
"oil_cake_tb.html", inline_css = FALSE,
path = outdata.dir)
webshot(paste0(outdata.dir,"/oil_cake_tb.html"),paste0(outdata.dir,"/png/","oil_cake_tb.png"),
vwidth = 1100)
# cereals, meate.. balance market ----
cereals_list <- c("Barley",
"Grain maize",
"Other cereals",
"Wheat",
"Poultry meat",
"Rice milled",
"Sugar","Fish and other acquatic products")
# basline: load balance market.
b_cereals <- filter_market_balance(balance_detailed_Baseline, cereals_list)
# Scenario: load balance market.
s_cereals <- filter_market_balance(balance_detailed_Scenario, cereals_list)
# calculate the absolute and percentage changes between baseline and scenario.
cereals <- cal_percentage_change(b_cereals,s_cereals)
cereals_tb <- nicetable(cereals,"baseline for cereals, sugar, and meat markets") %>%
gtsave(
"cereals_tb.html", inline_css = FALSE,
path = outdata.dir)
webshot(paste0(outdata.dir,"/cereals_tb.html"),paste0(outdata.dir,"/png/","cereals_tb.png"),
vwidth = 1100)
############# 35 rows
# baseline
#EU27yr19: 37
supply_details_baseline_1<- convert_supply_details(region_list= "EU27yr19",
product_list= product_list$code,
scenario_list= sanky_file1,
folder = gdx.dir)
# sc
supply_details_sc_1 <- convert_supply_details(region_list= "EU27yr19",
product_list= product_list$code,
scenario_list= sanky_file2,
folder = gdx.dir)
######### 60 rows
supply_details_baseline_3 <- convert_supply_details(region_list= "EU",
product_list= product_list.all,
scenario_list= sanky_file1,
folder = gdx.dir)
supply_details_sc_3 <- convert_supply_details(region_list= "EU",
product_list= product_list.all,
scenario_list= sanky_file2,
folder = gdx.dir)
#step 2
# filter
sel_supply_details_bs_1 <-filter_supply_details(supply_details = supply_details_baseline_1, min.Level = 0, min.gross.value.added = 0)
sel_supply_details_sc_1 <-filter_supply_details(supply_details = supply_details_sc_1, min.Level = 0, min.gross.value.added = 0)
#step 3
# output tables
supply_tb <- cal_diff_percentage_change(sel_supply_details_bs_1,sel_supply_details_sc_1,supply_details = TRUE, abs = TRUE, percent_change = TRUE)
# setp 4
# make nice table
nice_supply_details_table(supply_tb, "activity", min.abs = 1000, min.percent_change = -10000) %>%
gtsave(
"supply_details_tb_product_list.html", inline_css = FALSE,
path = outdata.dir)
# supply_tb %>%
# filter(diff_level > min.abs)%>%
# filter(diff_gross_value_added > min.abs)%>%
# filter(level > min.percent_change)%>%
# filter(gross_value_added > min.percent_change)
#
#
# supply_tb %>% select(2:4)
remotes::install_github('rstudio/DT')
tb <- DT::datatable(supply_tb, class = 'cell-border stripe')
mytable <- DT::datatable(supply_tb %>% janitor::remove_empty(which = "cols"), filter = 'top') %>%
# DT::formatRound( -1, 1) %>%
DT::formatPercentage(c('level','gross_value_added','volume'), digits = 1)
mytable
saveWidget(tb, "mytable.html")
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)
}
inst/examples/pic/capriv.png

986 KiB

......@@ -33,12 +33,12 @@ prod_list = c("WHEA","MAIZ","BARL","RAPE","SUNF","PULS",
###################################################################################################
# load market balance
balance_detailed_Baseline <- convert_balance_detailed("EU",
# Get detailed balance tables
detailed_balance_Baseline <- convert_balance_detailed("EU",
prod_list,
sanky_file1,
folder = gdx.dir)
balance_detailed_Scenario <- convert_balance_detailed("EU",
detailed_balance_Scenario <- convert_balance_detailed("EU",
prod_list,
sanky_file2,
folder = gdx.dir)
......@@ -128,6 +128,7 @@ s_oil_cake <- filter_market_balance(balance_detailed_Scenario, oil_cake_key_list
# calculate the absolute and percentage changes between baseline and scenario.
oil_cake <- cal_diff_percentage_change(b_oil_cake,s_oil_cake,supply_details = FALSE)
## TODO filter abs percent change
# make a nice table
oil_cake_tb <- nicetable_market_balances(oil_cake,"baseline for oil and cake markets") %>%
tab_footnote(
......
......@@ -70,3 +70,38 @@ p2
ggsave(paste0( outdata.dir,"/png/cereals.png"), plot = p1,width = 16, height = 9, dpi = 100)
ggsave(paste0( outdata.dir,"/png/MAIF.png"), plot = p2,width = 16, height = 9, dpi = 100)
## test case for package: sf
library(rgdal)
library(tidyverse)
library(sp)
library(sf)
# load kml file
patialpolydf <- readOGR("D:/public/yang/CAPRIR_Project/caprir/inst/extdata/map/capri_map.kml", "capri_map")
# patialpolydf@data <- patialpolydf@data %>%
# left_join(mySel, by = c("Description" = "region")) %>% select(Name,Description,cols,min)
# Convert spatialpolydf to an sf object
spatialpolysf <- patialpolydf %>% st_as_sf()
new_sf <- spatialpolysf %>% filter(!grepl(paste(c("TR.*", "UK.*","PT20.*","PT30.*","ES70.*"), collapse = "|"), Description))
# observation_place <- patialpolysf@data
final <- left_join(new_sf, mySel, by = c("Description" = "region"))
# mySel$region <- sub("0+$", "",as.character(mySel$region))
#
# spatialpolysf <- observation_place %>%
# left_join(mySel, by = c("Description" = "region"))
ofar <- final[final$cols =="OFAR",]
soya <- final[final$cols =="SOYA",]
plot(ofar["min"])
plot(soya["min"])
plot(nc["AREA"], key.pos = 4)
......@@ -48,7 +48,7 @@ supply_tb <- cal_diff_percentage_change(bs,sc,supply_details = TRUE)
# step 3
# filter vectors and make a nice table
# filter value of vectors and make a nice table
nicetable_supply_details(supply_tb, "Cereals", abs = 0, percent_change = 0, vector_list = "all")
......@@ -61,3 +61,6 @@ nicetable_supply_details(supply_tb_2, "Cereals", abs = 104, percent_change = 2,
# "supply_details_tb_activity_list.html", inline_css = FALSE,
# path = outdata.dir)
......@@ -15,9 +15,9 @@
</head>
<body>
<div id="htmlwidget_container">
<div id="htmlwidget-21656281773e28a07763" style="width:1000px;height:600px;" class="plotly html-widget"></div>
<div id="htmlwidget-cff2effdea2dbb39df71" style="width:900px;height:1600px;" class="plotly html-widget"></div>
</div>
<script type="application/json" data-for="htmlwidget-21656281773e28a07763">{"x":{"visdat":{"a0403e2663e5":["function () ","plotlyVisDat"]},"cur_data":"a0403e2663e5","attrs":{"a0403e2663e5":{"orientation":"h","arrangement":"snap","valueformat":".0f","valuesuffix":" tonnes","node":{"label":["Production: 30,3K","Imports: 46,8K","Rape seed: 23,6K","Rape seed cake: 12,6K","Rape seed oil: 9,9K","Sunflower seed: 10,3K","Sunflowe seed cake: 6,6K","Sunflower seed oil: 3,8K","Soya seed: 13,0K","Soya cake: 29,0K","Soya oil: 3,8K","Pulses: 3,5K","Bio ethanol: 6,6K","DDG: 3,7K","Biofuels: 7,0K","Human Consumption: 10,8K","Feed: 53,9K","Exports: 6,8K","Processing: 3,3K"],"color":["#969696","#ff7f0e","#3182bd","#6baed6","#3182bd","#a55194","#de9ed6","#d180c1","#e7ba52","#bd9e39","#e7cb94","#ad494a","#74c400","#74c476","#74c476","#17becf","#2ca02c","#F7DC6F","#2ca02c"],"x":[0.01,0.01,0.2,0.5,0.35,0.2,0.5,0.35,0.2,0.5,0.35,0.2,0.65,0.65,0.5,0.8,0.8,0.8,0.8],"y":[0.1,0.5,0.01,0.1,0.2,0.45,0.5,0.55,0.3,0.3,0.3,0.6,0.14,0.6,0.7,0.01,0.3,0.5,0.8],"pad":20,"thickness":15,"line":{"color":"blau","width":1}},"link":{"source":[0,1,2,2,2,2,2,2,3,4,3,4,4,3,4,3,4,1,1,0,1,5,5,5,5,5,5,6,7,7,7,6,7,6,7,1,1,0,1,8,8,8,8,8,8,9,10,9,10,10,9,10,9,10,1,1,0,1,11,11,11,11,1,1,12,13,13,14,14],"target":[2,2,15,14,16,17,3,4,15,15,18,18,14,16,16,17,17,3,4,5,5,15,14,16,17,6,7,15,15,18,14,16,16,17,17,6,7,8,8,15,14,16,17,9,10,15,15,18,18,14,16,16,17,17,9,10,11,11,15,18,16,17,12,13,17,16,17,12,13],"value":[15505.8038374547,8071.90928312898,938.338658500833,1222.67580502477,779.499236866396,36.2802989610345,12157.3088284419,9449.91089053713,83.0434775855083,2628.19480873541,281.613356836426,2134.65971874564,4239.94376764957,11168.5161419345,396.627701081913,1049.58495155108,474.275882036066,425.449099465671,423.790987711462,9614.86771374554,686.25647842396,642.498401922002,51.9192918392788,332.638276400189,2898.13992990565,3505.06815336442,2969.79492421528,25.9052268866346,2561.05149066626,406.305472655173,382.496185591055,6463.32681780533,168.953266245122,119.964231091788,276.247065185574,3104.12812241934,825.258556127898,2598.00952529264,10406.872969096,344.964807231247,488.278275777619,929.474971893696,100.704959599177,9349.74770049922,2282.69958744348,97.9823859932619,1907.87806064876,169.733652492909,243.185006695542,624.519961154259,28038.6146382023,275.889177186896,668.718457528291,797.455473511366,19625.3014337175,1566.22809175334,2579.41594981919,922.556223034913,1570.33121499805,38.5316851203947,1623.14278366453,269.966489071133,709.629088834886,11.7036213133086,105.404584548037,3706.17864730134,9.74881795688458,5859.40835079277,3704.22384394491],"color":["#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)"]},"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"sankey"}},"layout":{"width":1000,"height":600,"margin":{"b":50,"l":10,"t":50,"r":10,"pad":40},"autosize":false,"title":"Market Balance in Tonnens","font":{"size":13,"family":"Arial"},"xaxis":{"showgrid":false,"zeroline":false},"yaxis":{"showgrid":false,"zeroline":false},"hovermode":"closest","showlegend":false},"source":"A","config":{"showSendToCloud":false},"data":[{"orientation":"h","arrangement":"snap","valueformat":".0f","valuesuffix":" tonnes","node":{"label":["Production: 30,3K","Imports: 46,8K","Rape seed: 23,6K","Rape seed cake: 12,6K","Rape seed oil: 9,9K","Sunflower seed: 10,3K","Sunflowe seed cake: 6,6K","Sunflower seed oil: 3,8K","Soya seed: 13,0K","Soya cake: 29,0K","Soya oil: 3,8K","Pulses: 3,5K","Bio ethanol: 6,6K","DDG: 3,7K","Biofuels: 7,0K","Human Consumption: 10,8K","Feed: 53,9K","Exports: 6,8K","Processing: 3,3K"],"color":["#969696","#ff7f0e","#3182bd","#6baed6","#3182bd","#a55194","#de9ed6","#d180c1","#e7ba52","#bd9e39","#e7cb94","#ad494a","#74c400","#74c476","#74c476","#17becf","#2ca02c","#F7DC6F","#2ca02c"],"x":[0.01,0.01,0.2,0.5,0.35,0.2,0.5,0.35,0.2,0.5,0.35,0.2,0.65,0.65,0.5,0.8,0.8,0.8,0.8],"y":[0.1,0.5,0.01,0.1,0.2,0.45,0.5,0.55,0.3,0.3,0.3,0.6,0.14,0.6,0.7,0.01,0.3,0.5,0.8],"pad":20,"thickness":15,"line":{"color":"blau","width":1}},"link":{"source":[0,1,2,2,2,2,2,2,3,4,3,4,4,3,4,3,4,1,1,0,1,5,5,5,5,5,5,6,7,7,7,6,7,6,7,1,1,0,1,8,8,8,8,8,8,9,10,9,10,10,9,10,9,10,1,1,0,1,11,11,11,11,1,1,12,13,13,14,14],"target":[2,2,15,14,16,17,3,4,15,15,18,18,14,16,16,17,17,3,4,5,5,15,14,16,17,6,7,15,15,18,14,16,16,17,17,6,7,8,8,15,14,16,17,9,10,15,15,18,18,14,16,16,17,17,9,10,11,11,15,18,16,17,12,13,17,16,17,12,13],"value":[15505.8038374547,8071.90928312898,938.338658500833,1222.67580502477,779.499236866396,36.2802989610345,12157.3088284419,9449.91089053713,83.0434775855083,2628.19480873541,281.613356836426,2134.65971874564,4239.94376764957,11168.5161419345,396.627701081913,1049.58495155108,474.275882036066,425.449099465671,423.790987711462,9614.86771374554,686.25647842396,642.498401922002,51.9192918392788,332.638276400189,2898.13992990565,3505.06815336442,2969.79492421528,25.9052268866346,2561.05149066626,406.305472655173,382.496185591055,6463.32681780533,168.953266245122,119.964231091788,276.247065185574,3104.12812241934,825.258556127898,2598.00952529264,10406.872969096,344.964807231247,488.278275777619,929.474971893696,100.704959599177,9349.74770049922,2282.69958744348,97.9823859932619,1907.87806064876,169.733652492909,243.185006695542,624.519961154259,28038.6146382023,275.889177186896,668.718457528291,797.455473511366,19625.3014337175,1566.22809175334,2579.41594981919,922.556223034913,1570.33121499805,38.5316851203947,1623.14278366453,269.966489071133,709.629088834886,11.7036213133086,105.404584548037,3706.17864730134,9.74881795688458,5859.40835079277,3704.22384394491],"color":["#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)"]},"type":"sankey","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-21656281773e28a07763">{"viewer":{"width":1000,"height":600,"padding":0,"fill":false},"browser":{"width":1000,"height":600,"padding":0,"fill":false}}</script>
<script type="application/json" data-for="htmlwidget-cff2effdea2dbb39df71">{"x":{"visdat":{"9d8c5cca15c6":["function () ","plotlyVisDat"]},"cur_data":"9d8c5cca15c6","attrs":{"9d8c5cca15c6":{"orientation":"h","arrangement":"snap","valueformat":".0f","valuesuffix":" tonnes","node":{"label":["Production: 30.3K","Imports: 46.8K","Rape seed: 23.6K","Rape seed cake: 12.6K","Rape seed oil: 9.9K","Sunflower seed: 10.3K","Sunflowe seed cake: 6.6K","Sunflower seed oil: 3.8K","Soya seed: 13.0K","Soya cake: 29.0K","Soya oil: 3.8K","Pulses: 3.5K","Bio ethanol: 6.6K","DDG: 3.7K","Biofuels: 7.0K","Human Consumption: 10.8K","Feed: 53.9K","Exports: 6.8K","Processing: 3.3K"],"color":["#969696","#ff7f0e","#3182bd","#6baed6","#3182bd","#a55194","#de9ed6","#d180c1","#e7ba52","#bd9e39","#e7cb94","#ad494a","#74c400","#74c476","#74c476","#17becf","#2ca02c","#F7DC6F","#2ca02c"],"x":null,"y":null,"pad":20,"thickness":15,"line":{"color":"blau","width":1}},"link":{"source":[0,1,2,2,2,2,2,2,3,4,3,4,4,3,4,3,4,1,1,0,1,5,5,5,5,5,5,6,7,7,7,6,7,6,7,1,1,0,1,8,8,8,8,8,8,9,10,9,10,10,9,10,9,10,1,1,0,1,11,11,11,11,1,1,12,13,13,14,14],"target":[2,2,15,14,16,17,3,4,15,15,18,18,14,16,16,17,17,3,4,5,5,15,14,16,17,6,7,15,15,18,14,16,16,17,17,6,7,8,8,15,14,16,17,9,10,15,15,18,18,14,16,16,17,17,9,10,11,11,15,18,16,17,12,13,17,16,17,12,13],"value":[15505.8038374547,8071.90928312898,938.338658500833,1222.67580502477,779.499236866396,36.2802989610345,12157.3088284419,9449.91089053713,83.0434775855083,2628.19480873541,281.613356836426,2134.65971874564,4239.94376764957,11168.5161419345,396.627701081913,1049.58495155108,474.275882036066,425.449099465671,423.790987711462,9614.86771374554,686.25647842396,642.498401922002,51.9192918392788,332.638276400189,2898.13992990565,3505.06815336442,2969.79492421528,25.9052268866346,2561.05149066626,406.305472655173,382.496185591055,6463.32681780533,168.953266245122,119.964231091788,276.247065185574,3104.12812241934,825.258556127898,2598.00952529264,10406.872969096,344.964807231247,488.278275777619,929.474971893696,100.704959599177,9349.74770049922,2282.69958744348,97.9823859932619,1907.87806064876,169.733652492909,243.185006695542,624.519961154259,28038.6146382023,275.889177186896,668.718457528291,797.455473511366,19625.3014337175,1566.22809175334,2579.41594981919,922.556223034913,1570.33121499805,38.5316851203947,1623.14278366453,269.966489071133,709.629088834886,11.7036213133086,105.404584548037,3706.17864730134,9.74881795688458,5859.40835079277,3704.22384394491],"color":["#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)"]},"alpha_stroke":1,"sizes":[10,100],"spans":[1,20],"type":"sankey"}},"layout":{"width":900,"height":1600,"margin":{"b":50,"l":10,"t":50,"r":10,"pad":40},"autosize":false,"title":"Market Balance in Tonnens","font":{"size":13,"family":"Arial"},"xaxis":{"showgrid":false,"zeroline":false},"yaxis":{"showgrid":false,"zeroline":false},"hovermode":"closest","showlegend":false},"source":"A","config":{"showSendToCloud":false},"data":[{"orientation":"h","arrangement":"snap","valueformat":".0f","valuesuffix":" tonnes","node":{"label":["Production: 30.3K","Imports: 46.8K","Rape seed: 23.6K","Rape seed cake: 12.6K","Rape seed oil: 9.9K","Sunflower seed: 10.3K","Sunflowe seed cake: 6.6K","Sunflower seed oil: 3.8K","Soya seed: 13.0K","Soya cake: 29.0K","Soya oil: 3.8K","Pulses: 3.5K","Bio ethanol: 6.6K","DDG: 3.7K","Biofuels: 7.0K","Human Consumption: 10.8K","Feed: 53.9K","Exports: 6.8K","Processing: 3.3K"],"color":["#969696","#ff7f0e","#3182bd","#6baed6","#3182bd","#a55194","#de9ed6","#d180c1","#e7ba52","#bd9e39","#e7cb94","#ad494a","#74c400","#74c476","#74c476","#17becf","#2ca02c","#F7DC6F","#2ca02c"],"x":[],"y":[],"pad":20,"thickness":15,"line":{"color":"blau","width":1}},"link":{"source":[0,1,2,2,2,2,2,2,3,4,3,4,4,3,4,3,4,1,1,0,1,5,5,5,5,5,5,6,7,7,7,6,7,6,7,1,1,0,1,8,8,8,8,8,8,9,10,9,10,10,9,10,9,10,1,1,0,1,11,11,11,11,1,1,12,13,13,14,14],"target":[2,2,15,14,16,17,3,4,15,15,18,18,14,16,16,17,17,3,4,5,5,15,14,16,17,6,7,15,15,18,14,16,16,17,17,6,7,8,8,15,14,16,17,9,10,15,15,18,18,14,16,16,17,17,9,10,11,11,15,18,16,17,12,13,17,16,17,12,13],"value":[15505.8038374547,8071.90928312898,938.338658500833,1222.67580502477,779.499236866396,36.2802989610345,12157.3088284419,9449.91089053713,83.0434775855083,2628.19480873541,281.613356836426,2134.65971874564,4239.94376764957,11168.5161419345,396.627701081913,1049.58495155108,474.275882036066,425.449099465671,423.790987711462,9614.86771374554,686.25647842396,642.498401922002,51.9192918392788,332.638276400189,2898.13992990565,3505.06815336442,2969.79492421528,25.9052268866346,2561.05149066626,406.305472655173,382.496185591055,6463.32681780533,168.953266245122,119.964231091788,276.247065185574,3104.12812241934,825.258556127898,2598.00952529264,10406.872969096,344.964807231247,488.278275777619,929.474971893696,100.704959599177,9349.74770049922,2282.69958744348,97.9823859932619,1907.87806064876,169.733652492909,243.185006695542,624.519961154259,28038.6146382023,275.889177186896,668.718457528291,797.455473511366,19625.3014337175,1566.22809175334,2579.41594981919,922.556223034913,1570.33121499805,38.5316851203947,1623.14278366453,269.966489071133,709.629088834886,11.7036213133086,105.404584548037,3706.17864730134,9.74881795688458,5859.40835079277,3704.22384394491],"color":["#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#7DC1E380","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F2D0EE80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#F6DF9B80","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","#DB969780","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)","rgba(123,123,123,0.1)"]},"type":"sankey","frame":null}],"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.2,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
<script type="application/htmlwidget-sizing" data-for="htmlwidget-cff2effdea2dbb39df71">{"viewer":{"width":900,"height":1600,"padding":0,"fill":false},"browser":{"width":900,"height":1600,"padding":0,"fill":false}}</script>
</body>
</html>
inst/outdata/png/MAIF.png

37.2 KiB | W: | H:

inst/outdata/png/MAIF.png

37.6 KiB | W: | H:

inst/outdata/png/MAIF.png
inst/outdata/png/MAIF.png
inst/outdata/png/MAIF.png
inst/outdata/png/MAIF.png
  • 2-up
  • Swipe
  • Onion skin
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/capri_maps.R
\name{colorMode}
\alias{colorMode}
\title{define color}
\usage{
colorMode()
}
\description{
define color
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/capri_maps.R
\name{element_textbox_highlight}
\alias{element_textbox_highlight}
\title{element textbox highlight}
\usage{
element_textbox_highlight(
...,
hi.labels = NULL,
hi.fill = NULL,
hi.col = NULL,
hi.box.col = NULL,
hi.family = NULL
)
}
\description{
element textbox highlight
}
......@@ -6,6 +6,7 @@
\usage{
extract_supply_details_longname(
region_list = "EU27yr19",
dimdef_activity,
activitySel = "Activities",
scenario_list,
folder
......
......@@ -19,3 +19,9 @@ A selected market balance.
\description{
Get market balances with seleceted commodities (long names / short names).
}
\examples{
\dontrun{filter_market_balance()}
}
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/capri_sankey.R
\name{linksum}
\alias{linksum}
\title{function calulates sum of links}
\usage{
linksum(balance_detailed_links)
}
\arguments{
\item{balance_detailed_links}{links.}
}
\value{
sum
}
\description{
function calulates sum of links
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/import_data.R
\name{load_xml_data}
\alias{load_xml_data}
\title{load coco_tables.xml and dimdefs_new.xml from capri directory
save coco_tables, dimdef_activity, dimdef_dim5, dimdef_product, dimdef_region}
\usage{
load_xml_data(xml.dir)
}
\arguments{
\item{xml.dir}{capri xml directory}
}
\description{
load coco_tables.xml and dimdefs_new.xml from capri directory
save coco_tables, dimdef_activity, dimdef_dim5, dimdef_product, dimdef_region
}
\examples{
\dontrun{
load_xml_data(xml.dir= "D:/public/yang/2021/tstrunk/GUI/views")
}
}
......@@ -4,7 +4,7 @@
\alias{nicetable_supply_details}
\title{makes Beautiful Table for the farm supply details}
\usage{
nicetable_supply_details(tbl, subtit, vector_list, abs = 5, percent_change = 1)
nicetable_supply_details(tbl, subtit, vector_list, abs = 0, percent_change = 0)
}
\arguments{
\item{tbl}{A tbl data frame.}
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/capri_sankey.R
\name{nodes_position}
\alias{nodes_position}
\title{sets the position of nodes}
\usage{
nodes_position(nodes)
}
\arguments{
\item{nodes}{nodes for drawing a sankey diagram.}
}
\value{
nodes with fixed position
}
\description{
sets the position of nodes
}