Skip to contents

Introduction

Recca (R Energy Conversion Chain Analysis) contains many functions useful for aggregating industries and products in energy conversion chains.

The types of aggregation are shown in the following table.

Function Meaning
primary_aggregates() Aggregates primary energy
finaldemand_aggregates() Aggregates final demand energy
region_aggregates() Aggregates regions
despecified_aggregates() Despecifies industries and products, then aggregates
grouped_aggregates() Groups industries and products, then aggregates
footprint_aggregates() Isolates each final demand product and sector, then aggregates by primary and final demand
effects_aggregates() Isolates each product in the resources matrix, then aggregates by primary and final demand

This vignette describes those functions and demonstrates their use.

primary_aggregates()

primary_aggregates() creates a column of primary energy sums coming from the industries specified in the p_industries argument. These industries are often found in the R, V, and Y matrices of the PSUT framework. Typical p_industries are Resources, Imports, and Exports. In the example below, primary aggregates are calculated for the four rows of the UKEnergy2000mats data frame.

In the first example, only 1 aggregate column is created (“EX.p”), because there is no difference between net and gross aggregation for primary energy. Net and gross primary aggregates are identical.

library(matsbyname)
p_industries <- c("Resources - Crude", "Resources - NG")
# Calculate primary total aggregates
ECCs <- UKEnergy2000mats %>%
  tidyr::pivot_wider(names_from = "matrix.name", values_from = "matrix")
ECCs
#> # A tibble: 4 × 12
#>   Country  Year Energy.type Last.…¹ R        U        U_EIOU   U_feed   V       
#>   <chr>   <dbl> <chr>       <chr>   <list>   <list>   <list>   <list>   <list>  
#> 1 GBR      2000 E           Final   <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 2 GBR      2000 E           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 3 GBR      2000 E           Useful  <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 4 GBR      2000 X           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> # … with 3 more variables: Y <list>, r_EIOU <list>, S_units <list>, and
#> #   abbreviated variable name ¹​Last.stage
res <- ECCs %>%
  Recca::primary_aggregates(p_industries = p_industries, by = "Total")
tibble::as_tibble(res)
#> # A tibble: 4 × 13
#>   Country  Year Energy.type Last.…¹ R        U        U_EIOU   U_feed   V       
#>   <chr>   <dbl> <chr>       <chr>   <list>   <list>   <list>   <list>   <list>  
#> 1 GBR      2000 E           Final   <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 2 GBR      2000 E           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 3 GBR      2000 E           Useful  <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 4 GBR      2000 X           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> # … with 4 more variables: Y <list>, r_EIOU <list>, S_units <list>,
#> #   EX.p <list>, and abbreviated variable name ¹​Last.stage
res[[Recca::aggregate_cols$aggregate_primary]]
#> [[1]]
#> [1] 93000
#> 
#> [[2]]
#> [1] 93000
#> 
#> [[3]]
#> [1] 93000
#> 
#> [[4]]
#> [1] 98220

In the next example, both net and gross aggregation columns are created (“EX.p_net” and “EX.p_gross”), for compatibility with the finaldemand_aggregates() function discussed below.

res2 <- ECCs %>%
  Recca::primary_aggregates(p_industries = p_industries,
                            add_net_gross_cols = TRUE,
                            by = "Total")
tibble::as_tibble(res2)
#> # A tibble: 4 × 14
#>   Country  Year Energy.type Last.…¹ R        U        U_EIOU   U_feed   V       
#>   <chr>   <dbl> <chr>       <chr>   <list>   <list>   <list>   <list>   <list>  
#> 1 GBR      2000 E           Final   <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 2 GBR      2000 E           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 3 GBR      2000 E           Useful  <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 4 GBR      2000 X           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> # … with 5 more variables: Y <list>, r_EIOU <list>, S_units <list>,
#> #   EX.p_net <list>, EX.p_gross <list>, and abbreviated variable name
#> #   ¹​Last.stage
res2[[Recca::aggregate_cols$net_aggregate_primary]]
#> [[1]]
#> [1] 93000
#> 
#> [[2]]
#> [1] 93000
#> 
#> [[3]]
#> [1] 93000
#> 
#> [[4]]
#> [1] 98220
res2[[Recca::aggregate_cols$gross_aggregate_primary]]
#> [[1]]
#> [1] 93000
#> 
#> [[2]]
#> [1] 93000
#> 
#> [[3]]
#> [1] 93000
#> 
#> [[4]]
#> [1] 98220

finaldemand_aggregates()

finaldemand_aggregates() is similar to primary_aggregates(), except that it aggregates energy at the final demand stage in the Y matrix.

fd_sectors <- c("Residential", "Transport")
res <- ECCs %>%
  Recca::finaldemand_aggregates(fd_sectors = fd_sectors, by = "Sector")
tibble::as_tibble(res)
#> # A tibble: 4 × 14
#>   Country  Year Energy.type Last.…¹ R        U        U_EIOU   U_feed   V       
#>   <chr>   <dbl> <chr>       <chr>   <list>   <list>   <list>   <list>   <list>  
#> 1 GBR      2000 E           Final   <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 2 GBR      2000 E           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 3 GBR      2000 E           Useful  <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> 4 GBR      2000 X           Servic… <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]> <dbl[…]>
#> # … with 5 more variables: Y <list>, r_EIOU <list>, S_units <list>,
#> #   EX.fd_net <list>, EX.fd_gross <list>, and abbreviated variable name
#> #   ¹​Last.stage
res[[Recca::aggregate_cols$net_aggregate_demand]]
#> [[1]]
#>             Product
#> Residential   31000
#> Transport     40750
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[2]]
#>                  Product
#> Residential 5.000750e+14
#> Transport   6.429166e+11
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[3]]
#>              Product
#> Residential  4200.40
#> Transport   21714.98
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[4]]
#>                  Product
#> Residential 5.000750e+14
#> Transport   6.429166e+11
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
res[[Recca::aggregate_cols$gross_aggregate_demand]]
#> [[1]]
#>             Product
#> Residential   31000
#> Transport     40750
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[2]]
#>                  Product
#> Residential 5.000750e+14
#> Transport   6.429166e+11
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[3]]
#>              Product
#> Residential  4200.40
#> Transport   21714.98
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
#> 
#> [[4]]
#>                  Product
#> Residential 5.000750e+14
#> Transport   6.429166e+11
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"

region_aggregates()

despecified_aggregates()

grouped_aggregates()

footprint_aggregates()

effects_aggregages()

Conclusion