View source: R/graph_functions.R
nonstat_alloc_plots_df | R Documentation |
This function adds a column of ggplot2
graphs to a completed allocation tables data frame.
The graphs are stored in a list column named plots
.
nonstat_alloc_plots_df(
.df,
countries,
data_col = "Data",
plots = "Plots",
country = IEATools::iea_cols$country,
ef_product = IEATools::template_cols$ef_product,
destination = IEATools::template_cols$destination,
quantity = IEATools::template_cols$quantity,
c_source = IEATools::template_cols$c_source,
year = IEATools::iea_cols$year,
.values = IEATools::template_cols$.values,
machine = IEATools::template_cols$machine,
eu_product = IEATools::template_cols$eu_product
)
.df |
The completed allocation tables data frame. Default is |
countries |
The countries for which allocation plots are to be created. |
data_col |
The name of the output column containing nested data for allocation graphs. Default is "Data". |
plots |
The name of the output column containing allocation graphs. Default is "Plots". |
country |
See |
ef_product, destination, quantity, c_source |
See |
year |
See |
.values, machine, eu_product |
See |
The data frame is grouped by all variables needed to create the allocation graph, specifically
country
, ef_product
, and destination
and nested prior to making the graphs, namely
machine
, eu_product
, quantity
, year
, .values
, and c_source
,
meaning that one allocation graph is constructed for each combination of those variables.
A data frame containing a list column of ggplot2
non-stationary allocation graphs.
# Make a simple data frame with the expected structure.
alloc_table <- tibble::tribble(~Country, ~Method, ~Energy.type, ~Year, ~Ef.product, ~Destination,
~.values, ~Machine, ~Quantity, ~Eu.product, ~C.source,
"GHA", "PCM", "E", 1971, "Gasoline", "Transport",
0.5, "Cars", "C_1 [%]", "MD", "World",
"GHA", "PCM", "E", 1971, "Gasoline", "Transport",
0.5, "Trucks", "C_2 [%]", "MD", "World",
"GHA", "PCM", "E", 2020, "Gasoline", "Transport",
0.2, "Cars", "C_1 [%]", "MD", "World",
"GHA", "PCM", "E", 2020, "Gasoline", "Transport",
0.8, "Trucks", "C_2 [%]", "MD", "World",
"ZAF", "PCM", "E", 1971, "Gasoline", "Transport",
0.5, "Cars", "C_1 [%]", "MD", "World",
"ZAF", "PCM", "E", 1971, "Gasoline", "Transport",
0.5, "Trucks", "C_2 [%]", "MD", "World",
"ZAF", "PCM", "E", 2020, "Gasoline", "Transport",
0.3, "Cars", "C_1 [%]", "MD", "World",
"ZAF", "PCM", "E", 2020, "Gasoline", "Transport",
0.7, "Trucks", "C_2 [%]", "MD", "World")
alloc_plots_df(alloc_table, c("GHA", "ZAF"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.