Final demand energy and exergy aggregates with units
Source:R/aggregates.R
finaldemand_aggregates_with_units.Rd
Calculates aggregate final demand energy and services from a data frame of Supply-Use matrices.
The calculation includes non-energy uses if they are present in the final demand matrix.
The calculation does not include balancing items (Losses and Statistical differences).
If .sutdata
is a data frame, fd_sectors
should be the name of a column in the data frame.
If .sutdata
is NULL
, fd_sectors
can be a single vector of industry names.
Usage
finaldemand_aggregates_with_units(
.sutdata,
fd_sectors,
pattern_type = c("exact", "leading", "trailing", "anywhere"),
U = Recca::psut_cols$U,
Y = Recca::psut_cols$Y,
r_EIOU = Recca::psut_cols$r_eiou,
S_units = Recca::psut_cols$S_units,
by = c("Total", "Product", "Sector"),
net_aggregate_demand = Recca::aggregate_cols$net_aggregate_demand,
gross_aggregate_demand = Recca::aggregate_cols$gross_aggregate_demand
)
Arguments
- .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
Y
andU_EIOU
matrices to cover both net (inY
) and gross (inY
andU_EIOU
) final demand.- pattern_type
One of "exact", "leading", "trailing", or "anywhere" which specifies how matches are made for
fd_sectors
. If "exact", exact matches specify the sectors to be aggregated. If "leading", sectors are aggregated if any entry infd_sectors
matches the leading part of a final demand sector's name. If "trailing", sectors are aggregated if any entry infd_sectors
matches the trailing part of a final demand sector's name. If "anywhere", sectors are aggregated if any entry infd_sectors
matches any part of a final demand sector's name. Default is "exact".- U
Use (
U
) matrix or name of the column in.sutdata
containing same.- Y
Final demand (
Y
) matrix or name of the column in.sutdata
containing same.- r_EIOU
Matrix of ratios of EIOU for the make (
U
) matrix or name of the column in.sutdata
containing same.- S_units
The name of the column in
.sutdata
containingS_units
matrices.- 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
The name of net energy demand (which excludes energy industry own use) on output.
- gross_aggregate_demand
The name of gross energy demand (which includes energy industry own use) on output.