Title: | An Open-Source Tool for Visualization of Climate Mitigation Scenarios |
---|---|
Description: | Generic functions to produce area/bar/box/line plots of data following IAMC (Integrated Assessment Modeling Consortium) submission format. |
Authors: | Diego Silva Herran [aut], Jiayang WANG [aut], Masahiro SUGIYAMA [aut], Hiroto SHIRAKI [aut], Akimitsu Inoue [ctr, cre] |
Maintainer: | Akimitsu Inoue <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.1 |
Built: | 2024-12-08 07:18:07 UTC |
Source: | CRAN |
Add credit text to a list of ggplot2 plot objects
add_credit_to_list_of_plot(list_of_plot)
add_credit_to_list_of_plot(list_of_plot)
list_of_plot |
list of ggplot2 plot objects |
list of modified ggplot2 plot objects
Add credit text and project URL to a ggplot2 plot object
add_credit_to_plot(plot_object)
add_credit_to_plot(plot_object)
plot_object |
ggplot2 plot object |
modified ggplot2 plot object
A sample dataset of IAMC format
ar5_db_sample_data
ar5_db_sample_data
A tibble data.table with 25240 rows and 7 variables:
model, categorical
scenario, categorical
region, ASIA, OECD90 or World
the name of simulated variable that changes over time
unit of a variable
year
the value of a variable
https://tntcat.iiasa.ac.at/AR5DB/dsd?Action=htmlpage&page=about
A sample rule table
ar5_db_sample_rule_table
ar5_db_sample_rule_table
A data frame of additivity rule.
rule id
name of left-side variable
name of right-side variable
hex color code
change column data type in data-set to be able to be treated as an IAMC data-set.
change_data_types_of_iamc_dataframe(iamc_data)
change_data_types_of_iamc_dataframe(iamc_data)
iamc_data |
data frame which has columns 'model', 'scenario', 'region', 'variable', 'period', 'unit' |
converted data-frame.
if dataset has all required fields, then returns TRUE
check_column_availability(iamc_data)
check_column_availability(iamc_data)
iamc_data |
IAMC data frame |
boolean flag
check if the format of given data is valid as an IAMC dataset.
check_format_of_iamc_dataframe(iamc_data)
check_format_of_iamc_dataframe(iamc_data)
iamc_data |
IAMC dataset in dataframe format |
TRUE if it is valid
Dataset in IAMC format rule is not rigid. This function corrects data types of columns in the dataset. If necessary columns is missing, it throws exception. Output object of this function is as follows:
type: data.table columns: model: factor scenario: factor region: factor variable: factor unit: factor period: double value: double
correct_format_of_iamc_dataframe(iamc_data)
correct_format_of_iamc_dataframe(iamc_data)
iamc_data |
IAMC dataset described above |
modified dataframe
This function is called in the mipplot_interactive_area() and provides R code to reproduce the currently drawn plot. This function cannot be used out of reactive expression in Shiny.
generate_code_to_plot_area( input, name_of_input_data_variable, name_of_input_rule_table_variable )
generate_code_to_plot_area( input, name_of_input_data_variable, name_of_input_rule_table_variable )
input |
This is the same as the input argument in the shiny:ui(). |
name_of_input_data_variable |
A string such as "ar5_sample_data". |
name_of_input_rule_table_variable |
A string such as "ar5_sample_rule". |
A string representing the R code for rerun.
This function is called in the mipplot_interactive_bar() and provides R code to reproduce the currently drawn plot. This function cannot be used out of reactive expression in Shiny.
generate_code_to_plot_bar( input, name_of_input_data_variable, name_of_input_rule_table_variable )
generate_code_to_plot_bar( input, name_of_input_data_variable, name_of_input_rule_table_variable )
input |
This is the same as the input argument in the shiny:ui(). |
name_of_input_data_variable |
A string such as "ar5_sample_data". |
name_of_input_rule_table_variable |
A string such as "ar5_sample_rule". |
A string representing the R code for rerun.
from 'input' argument generally used in reactive context in Shiny, this function generates R code to reproduce current plot. This function could not used out of reactive expression in Shiny.
generate_code_to_plot_line(input, name_of_iamc_data_variable = "D")
generate_code_to_plot_line(input, name_of_iamc_data_variable = "D")
input |
it is same as the argument of shiny::ui() this function accesses following attributes: - model - period - variable - scenario - region |
name_of_iamc_data_variable |
name of IAMC data variable |
R code
select name of models from the column "model" then make unique it. output is character vector such as, c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4" )
get_model_name_list(D)
get_model_name_list(D)
D |
A quitte format dataframe of IAMC data to produce graph. |
A list of strings representing model names
select name of scenarios from the column "scenario" then make unique it. output is character vector such as, c("EMF27-450-Conv", "EMF27-450-FullTech", "EMF27-450-NoCCS", "EMF27-450-NucOff")
get_scenario_name_list(D)
get_scenario_name_list(D)
D |
A quitte format dataframe of IAMC data to produce graph. |
A list of strings representing scenario names
To evaluate expression, get string of expression
get_string_expression_of_vector_of_strings(vector_of_strings)
get_string_expression_of_vector_of_strings(vector_of_strings)
vector_of_strings |
vector of strings, such as c("A", "B") |
An R code representing character vector
variable-group is a combination of one LHS and one or more RHS. this function outputs the list of names of variable-group in given rule-table. the format of return value is "LHS|RHS1,RHS2,RHS3,...".
get_variable_group_name_list(rule_table)
get_variable_group_name_list(rule_table)
rule_table |
A rule table |
variable group name
get_variable_group_name_list(ar5_db_sample_rule_table)
get_variable_group_name_list(ar5_db_sample_rule_table)
Scan rule-table and extract variable names in given variable-group.
get_variable_name_list_in_variable_group(group_name)
get_variable_name_list_in_variable_group(group_name)
group_name |
variable-group-name |
A list of strings representing variable names
get_variable_name_list_in_variable_group( "Final Energy|Industry,Residential and Commercial,Transportation")
get_variable_name_list_in_variable_group( "Final Energy|Industry,Residential and Commercial,Transportation")
Package contains generic functions to produce area/bar/box/line plots of data following IAMC submission format.
This function is used for debugging a rule table and data-set. An input is a rule table and a data-set, the outputs are some area plots showing the divergence between the left-side variable and the sum of the right-side variables.
mipplot_additivity_check(D, R, max_n_plots = Inf, plot_all = FALSE)
mipplot_additivity_check(D, R, max_n_plots = Inf, plot_all = FALSE)
D |
A dataframe of IAMC data in tibble format to produce area plots. |
R |
A dataframe of data aggregation rules (meta data). |
max_n_plots |
The maximum number of output plots. |
plot_all |
set FALSE to plot only inconsistent combinations |
A list of area plots.
if (interactive()) { mipplot_additivity_check( ar5_db_sample_data, ar5_db_sample_rule_table, max_n_plots = 10) }
if (interactive()) { mipplot_additivity_check( ar5_db_sample_data, ar5_db_sample_rule_table, max_n_plots = 10) }
This function is used for debugging a rule table and data-set. An input is a rule table and a data-set, the outputs are some bar plots showing the divergence between the left-side variable and the sum of the right-side variables.
mipplot_additivity_check_bar( D, R, target_scenarios, target_rule_ids = 4, show_all_scenarios = FALSE, show_all_rule_ids = FALSE, debug = FALSE )
mipplot_additivity_check_bar( D, R, target_scenarios, target_rule_ids = 4, show_all_scenarios = FALSE, show_all_rule_ids = FALSE, debug = FALSE )
D |
A dataframe of IAMC data in tibble format to produce area plots. |
R |
A dataframe of data aggregation rules (meta data). |
target_scenarios |
A character vector of scenario names |
target_rule_ids |
A list of rule id. |
show_all_scenarios |
Set TRUE to show all scenarios. |
show_all_rule_ids |
Set TRUE to show all rules. |
debug |
Set TRUE if show intermediate dataframe using View function. |
A list of bar plots.
mipplot_additivity_check_bar( ar5_db_sample_data, ar5_db_sample_rule_table, target_scenarios = c("EMF27-450-Conv", "EMF27-Base-NucOff"))
mipplot_additivity_check_bar( ar5_db_sample_data, ar5_db_sample_rule_table, target_scenarios = c("EMF27-450-Conv", "EMF27-Base-NucOff"))
Area plots using right-hand-side values of target additivity rule. The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions (two in this version).
mipplot_area( D, R, region = levels(D$region), scenario = levels(D$scenario), facet_x = NULL, facet_y = NULL, PRINT_OUT = FALSE, DEBUG = TRUE, fontsize = 20, color_code_specify = TRUE, one_hundred_percent_stacked = FALSE, axis_year_text_angle = 0, language = "en" )
mipplot_area( D, R, region = levels(D$region), scenario = levels(D$scenario), facet_x = NULL, facet_y = NULL, PRINT_OUT = FALSE, DEBUG = TRUE, fontsize = 20, color_code_specify = TRUE, one_hundred_percent_stacked = FALSE, axis_year_text_angle = 0, language = "en" )
D |
A dataframe of IAMC data in tibble format to produce area plots. |
R |
A dataframe of data aggregation rules (meta data). |
region |
A list of regions. |
scenario |
A list of scenario. |
facet_x |
facet_x |
facet_y |
facet_y |
PRINT_OUT |
set TRUE to generate PDF file. |
DEBUG |
set TRUE to show debug messages. |
fontsize |
font size of text. |
color_code_specify |
set FALSE if you apply default color palette. |
one_hundred_percent_stacked |
set TRUE if you want a graph of 100% stacked, set this to TRUE. |
axis_year_text_angle |
text angle of x axis |
language |
A string of language. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
A list of area plots.
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(2005 <= period) %>% filter(period <= 2100) mipplot_area(data_subset, ar5_db_sample_rule_table, region = c("ASIA"), scenario = c("EMF27-450-Conv"), one_hundred_percent_stacked = FALSE, axis_year_text_angle = 0, language = 'en')
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(2005 <= period) %>% filter(period <= 2100) mipplot_area(data_subset, ar5_db_sample_rule_table, region = c("ASIA"), scenario = c("EMF27-450-Conv"), one_hundred_percent_stacked = FALSE, axis_year_text_angle = 0, language = 'en')
fill colors automatically
mipplot_autofill_color(rule_table_without_colors)
mipplot_autofill_color(rule_table_without_colors)
rule_table_without_colors |
Incomplete color specification rule table. It dosen't contain "Color_code" column. |
Complete color specification rule table. It is containing "Color_code" column. However, if color complementation can not be performed automatically, the return value is an incomplete color specification.
Bar plots using right-hand-side values of target additivity rule. The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions.
mipplot_bar( D, R, region = levels(D$region), xby = "scenario", target_year = levels(as.factor(D$period)), facet_x = NULL, facet_y = NULL, PRINT_OUT = FALSE, DEBUG = TRUE, fontsize = 20, color_code_specify = TRUE, one_hundred_percent_stacked = FALSE, axis_scenario_text_angle = 0, language = "en" )
mipplot_bar( D, R, region = levels(D$region), xby = "scenario", target_year = levels(as.factor(D$period)), facet_x = NULL, facet_y = NULL, PRINT_OUT = FALSE, DEBUG = TRUE, fontsize = 20, color_code_specify = TRUE, one_hundred_percent_stacked = FALSE, axis_scenario_text_angle = 0, language = "en" )
D |
A dataframe of IAMC data in tibble format to produce plots. |
R |
A dataframe of data aggregation rules (meta data). |
region |
A list of region. |
xby |
name of axis. the default setting is "scenario". |
target_year |
target year. |
facet_x |
facet_x |
facet_y |
facet_y |
PRINT_OUT |
set TRUE to generate A PDF file. |
DEBUG |
set TRUE to show debug messages. |
fontsize |
size of font in the output plot. |
color_code_specify |
set FALSE if you apply default color palette. |
one_hundred_percent_stacked |
set TRUE if you want a graph of 100% stacked, set this to TRUE. |
axis_scenario_text_angle |
text angle of x axis |
language |
A string of language. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
A list of bar plots.
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(scenario %in% c("EMF27-450-Conv", "EMF27-450-FullTech")) mipplot_bar(data_subset, ar5_db_sample_rule_table, region = c("ASIA"), target_year = 2005, one_hundred_percent_stacked = FALSE, axis_scenario_text_angle = 0, language = 'en')
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(scenario %in% c("EMF27-450-Conv", "EMF27-450-FullTech")) mipplot_bar(data_subset, ar5_db_sample_rule_table, region = c("ASIA"), target_year = 2005, one_hundred_percent_stacked = FALSE, axis_scenario_text_angle = 0, language = 'en')
The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions
mipplot_box( D, region = levels(D$region), variable = levels(D$variable), target_year = levels(as.factor(D$period)), PRINT_OUT = FALSE, DEBUG = TRUE, language = "en" )
mipplot_box( D, region = levels(D$region), variable = levels(D$variable), target_year = levels(as.factor(D$period)), PRINT_OUT = FALSE, DEBUG = TRUE, language = "en" )
D |
A dataframe of IAMC data in tibble format to produce plots. |
region |
A list of regions. |
variable |
A list of variables. |
target_year |
target year. |
PRINT_OUT |
set TRUE to generate PDF file. |
DEBUG |
set TRUE to show debug messages. |
language |
A string of language. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
A list of box plots.
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(period == 2100) %>% filter(region == "OECD90") mipplot_box(data_subset)
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(period == 2100) %>% filter(region == "OECD90") mipplot_box(data_subset)
Default color palette.
mipplot_default_color_palette
mipplot_default_color_palette
A default color palette object, which maps variable name (such as "Land Use") to hex color code.
Generate mapper from name of variable to name of color
mipplot_generate_color_mapper(raw_table, category_separator = "\\|")
mipplot_generate_color_mapper(raw_table, category_separator = "\\|")
raw_table |
rule table which includes "Color_code" column. |
category_separator |
regular expression for separating right-hand-side variable name into categories. For example: separator should be "\|" for "Secondary Energy|Electricity|Coal" |
named list of named string vectors. for example,
result = list( "Emissions|CO2" = c( "Fossil Fuels and Industry" = "#17202a", "Land Use" = "#008000", ...), "Emissions|CO2|Fossil Fuels and Industry" = c( "Energy Demand" = "#444444", ... ),...
A function to launch interactive plot for additivity check.
mipplot_interactive_additivity_check_bar(D, R, debug = FALSE)
mipplot_interactive_additivity_check_bar(D, R, debug = FALSE)
D |
A quitte format dataframe of IAMC data to produce graph. |
R |
A table with additivity rules. |
debug |
Set TRUE if table view is required. |
No return value, called for side effects
if (interactive()) { mipplot_interactive_additivity_check_bar(ar5_db_sample_data, ar5_db_sample_rule_table) }
if (interactive()) { mipplot_interactive_additivity_check_bar(ar5_db_sample_data, ar5_db_sample_rule_table) }
Provides gui to set plotting parameter for area plot.
mipplot_interactive_area(D, R, language = "en")
mipplot_interactive_area(D, R, language = "en")
D |
A dataframe of IAMC data in tibble format to produce area plots. |
R |
A dataframe of data aggregation rules (meta data). |
language |
A string of language for initial plot. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
No return value, called for side effects
if (interactive()) { mipplot_interactive_area(ar5_db_sample_data, ar5_db_sample_rule_table) }
if (interactive()) { mipplot_interactive_area(ar5_db_sample_data, ar5_db_sample_rule_table) }
A function to launch interactive bar plot using right-hand-side values of target additivity rule. The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions
mipplot_interactive_bar(D, R, language = "en")
mipplot_interactive_bar(D, R, language = "en")
D |
A quitte format dataframe of IAMC data to produce graph. |
R |
A table with additivity rules. |
language |
A string of language for initial plot. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
No return value, called for side effects
if (interactive()) { mipplot_interactive_bar(ar5_db_sample_data, ar5_db_sample_rule_table) }
if (interactive()) { mipplot_interactive_bar(ar5_db_sample_data, ar5_db_sample_rule_table) }
A function to launch interactive line plot. The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions
mipplot_interactive_line(D, language = "en")
mipplot_interactive_line(D, language = "en")
D |
A quitte format dataframe of IAMC data to produce graph. |
language |
A string of language for initial plot. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
No return value, called for side effects
if (interactive()) { mipplot_interactive_line(ar5_db_sample_data) }
if (interactive()) { mipplot_interactive_line(ar5_db_sample_data) }
A function to launch interactive plot using Shiny
mipplot_interactive_plot_line(D, R)
mipplot_interactive_plot_line(D, R)
D |
A quitte format dataframe of IAMC data to produce graph. |
R |
A table with additivity rules. |
No return value, called for side effects
if (interactive()) { mipplot_interactive_plot_line(ar5_db_sample_data, ar5_db_sample_rule_table) }
if (interactive()) { mipplot_interactive_plot_line(ar5_db_sample_data, ar5_db_sample_rule_table) }
The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions
mipplot_line( D, region = levels(D$region), variable = levels(D$variable), colorby = "scenario", linetypeby = "model", shapeby = "model", scenario = levels(D$scenario), facet_x = NULL, facet_y = NULL, legend = TRUE, PRINT_OUT = FALSE, DEBUG = TRUE, axis_year_text_angle = 0, language = "en", max_scenarios = 15, max_models = 15 )
mipplot_line( D, region = levels(D$region), variable = levels(D$variable), colorby = "scenario", linetypeby = "model", shapeby = "model", scenario = levels(D$scenario), facet_x = NULL, facet_y = NULL, legend = TRUE, PRINT_OUT = FALSE, DEBUG = TRUE, axis_year_text_angle = 0, language = "en", max_scenarios = 15, max_models = 15 )
D |
A dataframe of IAMC data in tibble format to produce plots. |
region |
A list of regions. |
variable |
A list of variables. |
colorby |
an axis for color setting. |
linetypeby |
an axis for line type setting. |
shapeby |
an axis for shape setting. |
scenario |
A list of scenarios. |
facet_x |
facet_x |
facet_y |
facet_y |
legend |
set TRUE to plot legend. default is TRUE. |
PRINT_OUT |
set TRUE to generate PDF files. |
DEBUG |
set TRUE to show debug messages. |
axis_year_text_angle |
text angle of x axis |
language |
A string of language. Possible values are "en", "jp", "es", "zh-cn", "zh-tw". The default value is "en". |
max_scenarios |
Maximum number of scenarios to be shown. If legend is FALSE, this option is . |
max_models |
Maximum number of models to be shown. If legend is FALSE, this option is |
A list of line plots.
library(dplyr) data_subset <- ar5_db_sample_data %>% filter( model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4") ) %>% filter(2005 <= period) %>% filter(period <= 2100) mipplot_line( data_subset, variable = c("Emissions|CO2"), scenario = c("EMF27-450-Conv", "EMF27-450-FullTech", "EMF27-450-NoCCS"), region = c("ASIA"), legend = TRUE, axis_year_text_angle = 0, language = 'en')
library(dplyr) data_subset <- ar5_db_sample_data %>% filter( model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4") ) %>% filter(2005 <= period) %>% filter(period <= 2100) mipplot_line( data_subset, variable = c("Emissions|CO2"), scenario = c("EMF27-450-Conv", "EMF27-450-FullTech", "EMF27-450-NoCCS"), region = c("ASIA"), legend = TRUE, axis_year_text_angle = 0, language = 'en')
The function arguments include the input dataframe, labels for the plot/axes/legend, and faceting dimensions
mipplot_point( D, region = levels(D$region), variable = levels(D$variable), target_year = levels(as.factor(D$period)), colorby = "model", shapeby = "model", xby = "scenario", facetby = NULL, facet_x = NULL, facet_y = NULL, fontsize = 20, PRINT_OUT = FALSE, DEBUG = TRUE )
mipplot_point( D, region = levels(D$region), variable = levels(D$variable), target_year = levels(as.factor(D$period)), colorby = "model", shapeby = "model", xby = "scenario", facetby = NULL, facet_x = NULL, facet_y = NULL, fontsize = 20, PRINT_OUT = FALSE, DEBUG = TRUE )
D |
A dataframe of IAMC data in tibble format to produce plots. |
region |
A list of regions. |
variable |
A list of variables. |
target_year |
A list of target years. |
colorby |
An axis for color setting. |
shapeby |
An axis for shape setting. |
xby |
An axis for x locating setting. |
facetby |
facetby. |
facet_x |
facet_x. |
facet_y |
facet_y. |
fontsize |
font size. |
PRINT_OUT |
set TRUE to generate PDF image. |
DEBUG |
set TRUE to show debug messages. |
A list of point plots.
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(period == 2100) %>% filter(region == "OECD90") mipplot_point(data_subset)
library(dplyr) data_subset <- ar5_db_sample_data %>% filter(variable == "Emissions|CO2|Land Use") %>% filter(model %in% c("AIM-Enduse 12.1", "GCAM 3.0", "IMAGE 2.4")) %>% filter(period == 2100) %>% filter(region == "OECD90") mipplot_point(data_subset)
This function plots a ggplot plots to PDF file.
mipplot_print_pdf( p_list1, filelabel = "", filename = tryCatch(file.choose(new = TRUE), error = function(e) { NA }) )
mipplot_print_pdf( p_list1, filelabel = "", filename = tryCatch(file.choose(new = TRUE), error = function(e) { NA }) )
p_list1 |
A list of ggplot plot. |
filelabel |
A string of prefix of output filename. |
filename |
A string of filename. If it is given, filelabel is ignored. |
No return value, called for side effects
if (interactive()) { p <- mipplot_area(ar5_db_sample_data, ar5_db_sample_rule_table, region = "World", scenario = "EMF27-450-FullTech") mipplot_print_pdf(p) }
if (interactive()) { p <- mipplot_area(ar5_db_sample_data, ar5_db_sample_rule_table, region = "World", scenario = "EMF27-450-FullTech") mipplot_print_pdf(p) }
Read scenario input data (in IAMC format) as tibble format dataframe.
mipplot_read_iamc( filename = NULL, sep = ",", interactive = FALSE, DEBUG = TRUE )
mipplot_read_iamc( filename = NULL, sep = ",", interactive = FALSE, DEBUG = TRUE )
filename |
Path to a file containing scenario data in IAMC format. |
sep |
A character indicating the separator used in the input file. |
interactive |
open a dialog for selecting file if interactive=TRUE. |
DEBUG |
experimental. |
A dataframe in tibble format ("model, scenario, variable, unit, period, value")
## Not run: mipplot_read_iamc("filename") ## End(Not run)
## Not run: mipplot_read_iamc("filename") ## End(Not run)
Read table of additivity rule and adds column with id number.
mipplot_read_ruletab(R_without_id)
mipplot_read_ruletab(R_without_id)
R_without_id |
Path to a file containing data of additivity rule. |
A dataframe of additivity rule ("ID, Left_side, Right_side")
## Not run: mipplot_read_ruletab("filename") ## End(Not run)
## Not run: mipplot_read_ruletab("filename") ## End(Not run)
Mutated Table using filtered variable from the rule table The function arguments include the input dataframes: The SR15 dataset and the Rule Table and returns a mutated table with variable, value, model, scenario, region, period
mipplot_return_table(D, R)
mipplot_return_table(D, R)
D |
A dataframe of IAMC data in tibble format to produce mutated table |
R |
A dataframe of data aggregation rules |
Mutated Table of model,scenario,region,variable,unit,period,value
mipplot_return_table(sr15_sample_data, sr15_sample_conversion_rule_table)
mipplot_return_table(sr15_sample_data, sr15_sample_conversion_rule_table)
Verify whether data of variables included in list template have been submitted.
mipplot_var_submission(D, V, na_name = "N/A")
mipplot_var_submission(D, V, na_name = "N/A")
D |
input data table |
V |
list of variables |
na_name |
string for N/A |
A dataframe representing variable availabilities.
Read scenario input data (in IAMC format) as tibble format dataframe from Excel
read_iamc_xlsx(file_path, sheet = 2)
read_iamc_xlsx(file_path, sheet = 2)
file_path |
Path to a file containing scenario data in IAMC format. |
sheet |
the index of sheet which contains records. |
A dataframe in tibble format ("model, scenario, variable, unit, period, value")
## Not run: read_iamc_xlsx("filename", sheet = 2) ## End(Not run)
## Not run: read_iamc_xlsx("filename", sheet = 2) ## End(Not run)
Generally, the range of the input value of stacked chart is greater than or equal to zero. This function splits variable into positive and negative parts in order to include negative values to stacked chart.
split_variable_into_positive_and_negative_parts( df_all, domain_column_name, variable_column_name, value_column_name, variable_name_converter = function(x) { paste(x, "_negative", sep = "") }, increment_of_domain_in_interpolation = 0.1 )
split_variable_into_positive_and_negative_parts( df_all, domain_column_name, variable_column_name, value_column_name, variable_name_converter = function(x) { paste(x, "_negative", sep = "") }, increment_of_domain_in_interpolation = 0.1 )
df_all |
input data frame |
domain_column_name |
domain column name, such as year |
variable_column_name |
variable column name, such as 'coal' |
value_column_name |
value column name, such as 'val' |
variable_name_converter |
function which convert original variable name into its negative part name |
increment_of_domain_in_interpolation |
step size for interpolation |
modified data frame
A sample conversion rule table for mipplot_return_table.
sr15_sample_conversion_rule_table
sr15_sample_conversion_rule_table
An object of class data.frame
with 37 rows and 6 columns.
A sample dataset of IAMC format consist of a subset of IPCC special report (Global Warming of 1.5°C, 2018).
sr15_sample_data
sr15_sample_data
A tibble data.table with 396425 rows and 7 variables:
model, categorical
scenario, categorical
region, ASIA, OECD90 or World
the name of simulated variable that changes over time
unit of a variable
year
the value of a variable
https://data.ene.iiasa.ac.at/iamc-1.5c-explorer/