finaldemand_aggregates | R Documentation |
Calculates aggregate final demand energy from a data frame of Supply-Use matrices.
The calculation counts only fd_sectors
in final demand aggregates.
If .sutdata
is NULL
, fd_sectors
can be a single vector of industry names.
finaldemand_aggregates(
.sutdata = NULL,
fd_sectors,
piece = "all",
notation = RCLabels::notations_list,
pattern_type = c("exact", "leading", "trailing", "anywhere", "literal"),
prepositions = RCLabels::prepositions_list,
U_eiou = Recca::psut_cols$U_eiou,
Y = Recca::psut_cols$Y,
by = c("Total", "Product", "Sector", "Industry"),
net_aggregate_demand = Recca::aggregate_cols$net_aggregate_demand,
gross_aggregate_demand = Recca::aggregate_cols$gross_aggregate_demand
)
.sutdata |
A data frame with columns of matrices from a supply-use analysis. |
fd_sectors |
A vector of names of sectors in final demand.
Names should include columns in the |
piece, notation, pattern_type, prepositions |
Arguments that control the way row and column matching
is accomplished when selecting parts of the U_EIOU and Y
matrices for final demand aggregation.
These arguments are passed to
|
U_eiou, Y |
Input matrices. See |
by |
One of "Product", "Sector", or "Total" to indicate the desired aggregation: "Product" for aggregation by energy carrier (Crude oil, Primary solid biofuels, etc.), "Sector" for aggregation by final demand sector (Agriculture/forestry, Domestic navigation, etc.), or "Total" for aggregation over both Product and Sector (the default). |
net_aggregate_demand, gross_aggregate_demand |
See |
Net energy demand is calculated by matsbyname::sum_byname(Y_fd)
, with sums across rows, columns, or total as needed.
Gross energy demand is calculated by matsbyname::sum_byname(Y_fd) + matsbyname::sum_byname(U_EIOU)
,
with sums across rows, columns, or total as needed.
A list or data frame containing net_aggregate_demand
and gross_aggregate_demand
columns.
library(matsbyname)
UKEnergy2000mats %>%
tidyr::pivot_wider(names_from = "matrix.name", values_from = "matrix") %>%
dplyr::mutate(
fd_sectors = rep(list(c("Residential", "Transport")), times = nrow(.))
) %>%
dplyr::filter(Last.stage %in% c(IEATools::last_stages$final,
IEATools::last_stages$useful)) %>%
finaldemand_aggregates(fd_sectors = "fd_sectors", by = "Sector")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.