primary_aggregates | R Documentation |
Calculates aggregate primary energy from a data frame of Supply-Use matrices.
primary_aggregates(
.sutdata = NULL,
p_industries,
add_net_gross_cols = FALSE,
piece = "all",
notation = RCLabels::notations_list,
pattern_type = c("exact", "leading", "trailing", "anywhere", "literal"),
prepositions = RCLabels::prepositions_list,
R = Recca::psut_cols$R,
V = Recca::psut_cols$V,
Y = Recca::psut_cols$Y,
by = c("Total", "Product", "Industry", "Flow"),
aggregate_primary = Recca::aggregate_cols$aggregate_primary,
net_aggregate_primary = Recca::aggregate_cols$net_aggregate_primary,
gross_aggregate_primary = Recca::aggregate_cols$gross_aggregate_primary
)
.sutdata |
A data frame with columns of matrices from a supply-use analysis. |
p_industries |
A vector of names of industries to be aggregated as "primary."
If |
add_net_gross_cols |
A boolean that tells whether to add net and gross columns ( |
piece, notation, pattern_type, prepositions |
Arguments that control the way row and column matching
is accomplished when selecting parts of the R, V, and Y
matrices for primary aggregation.
These arguments are passed to
|
R, V, Y |
See |
by |
One of "Total", "Product", "Industry", or "Flow" to indicate the desired aggregation:
|
aggregate_primary, net_aggregate_primary, gross_aggregate_primary |
The names for aggregates of primary energy on output. |
By default, this function adds a single column of primary energy aggregates
with the name aggregate_primary
.
If add_net_gross_cols
is TRUE
(default is FALSE
),
two columns are created:
net_aggregate_primary
and gross_aggregate_primary
.
With net and gross output (add_net_gross_cols = TRUE
),
the columns contain identical values.
Use add_net_gross_cols = TRUE
if you later wish to combine with
results from finaldemand_aggregates()
,
which provides both net and gross outputs.
A list or data frame containing aggregate primary energy.
library(matsbyname)
p_industries <- c("Resources - Crude", "Resources - NG")
# Calculate primary total aggregates
res <- UKEnergy2000mats %>%
tidyr::pivot_wider(names_from = "matrix.name", values_from = "matrix") %>%
Recca::primary_aggregates(p_industries = p_industries, by = "Total")
tibble::as_tibble(res)
res[[Recca::aggregate_cols$aggregate_primary]]
# Above, only 1 aggregate column is created, because there is no
# difference between net and gross aggregation for primary energy.
# Below, both net and gross aggregation columns are created,
# for compatibility with the [finaldemand_aggregates()] function.
# Net and gross primary aggregates are identical.
res2 <- UKEnergy2000mats %>%
tidyr::pivot_wider(names_from = "matrix.name", values_from = "matrix") %>%
Recca::primary_aggregates(p_industries = p_industries,
add_net_gross_cols = TRUE,
by = "Total")
tibble::as_tibble(res2)
res2[[Recca::aggregate_cols$net_aggregate_primary]]
res2[[Recca::aggregate_cols$gross_aggregate_primary]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.