title: "Release notes for Recca
"
output: html_document
Cite all releases with doi 10.5281/zenodo.5226085, which always resolves to the latest release.
extend_fu_details_to_exergy()
converts
the final-to-useful details matrices from energy to exergy.Remotes:
field to DESCRIPTION
file to assist
installation from the CLPFUDatabase
metapackage.gh-pages
branch for pkgdown website.region_aggregates()
would fail when
no countries to be aggregated were available and
drop_na_few
was FALSE
.calc_agg_eta_pfus()
where
efficiencies were calculated incorrectly when
primary energy was different
depending on the value of the Last.stage
column.calc_agg_eta_pfus()
calculates
primary, final, useful, and services aggregates and
associated efficiencies.remove_neu()
now also removes non-energy use products in the rows of Y.IEATools::nonenergy_use
.remove_neu()
eliminates "Non-energy useX"
(where "X" is any additional string such as " in Industry")
from the final demand matrix (Y)
and swims upstream with new_Y()
to remove any primary stage or useful stage
energy associated with Non-energy use.by
argument to pfu_aggregates()
now correctly
chooses the default value ("Total") if unspecified.node_edge_list()
that caused failure when
rowtypes
or coltypes
columns were not present.pfu_aggregates()
is a work in progress
but should (eventually) make calculating primary, final, and useful
aggregates easier.U
and U_feed
arguments removed from finaldemand_aggregates()
,
replaced by U_eiou
, which was calculated from
U
and U_feed
internally, and
U_eiou
is assumed to be present
in all energy conversion chain representations.by
argument to finaldemand_aggregates()
can now be "Industry",
which is treated as a synonym for "Sector".S_units_prime
column when chopping matrices.as.matrix()
to guard against
sparse matrices causing a failure in calc_yqfgW()
.Matrix
objects failed in
write_ecc_to_excel()
.
Thanks to Pierre Jacques for reporting this problem.calc_eta_fu_Y_eiou()
calculates
final-to-useful efficiencies for
every entry in Y and U_EIOU matrices,
responding to a feature request from Pierre Jacques.matsindf::matsindf_apply()
by setting default arguments to NULL
for several internal functions.region_aggregates()
gains drop_na_few
argument
that tells whether to eliminate rows
with NA
in few_colname
.chop_R()
now also chops by rows (industries),
since we are now including
all exogenous sources of energy in the R matrix.get_all_products_and_industries()
generates lists
of unique product and industry names for an ECC and
is aware of RCLabels
-type piece
s of row and column names.Remotes:
field in DESCRIPTION.
Instead, now using pkgdepends
syntax in
the extra-packages:
fields of R_CMD-check.yaml
and test-coverage.yaml
.verify_cols_missing()
from the Recca
package to matsindf
.
Those tests didn't belong in Recca
,
because verify_cols_missing()
is no longer in Recca
.NA
values
due to unit inhomogeneity. new_R_ps()
.tidyselect
warnings.write_ecc_to_excel()
now ensures that columns of U and rows of V
are the same, even if it means adding zero columns to U or
zero rows to V.
This change makes further Excel calculations easier.chopR()
now checks for the ability to swim downstream with
R_prime = R to re-create the original energy conversion chain,
thereby bringing consistency with chopY()
.
This approach identifies numerical precision errors
before they cause a problem.chopR()
now uses calc_io_mats(direction = "downstream")
,
thereby consistently using calc_io_mats()
for both
upstream and downstream swims.calc_io_mats()
gains new argument direction
that tells whether the input-output matrices
are for "upstream" or "downstream" swims.finaldemand_aggregates()
now produces true 0
instead of a 1x1 matrix without row or column labels
when no columns names of U_EIOU or Y
match fd_sectors
.new_Y()
.
There were compensatory formula errors
that only appeared in some edge cases.chop_R()
and chop_Y()
.effects_aggregates()
and footprint_aggregates()
to chop_R()
and chop_Y()
.effects_aggregates()
swims downstream from the R matrix to
final demand for each column (energy carrier)
in the R matrix and calculates primary and final demand aggregates.footprint_aggregates()
now checks that
the chopped ECCs sum to the original ECC
on every calculation.region_aggregates()
now correctly
eliminates the few_colname
when
the incoming data frame has no rows.footprint_aggregates()
now also includes the
*_prime_colname
matrices in the nested data frame.calc_io_mats()
and calc_L()
gain method
and tol
arguments
to control matrix inversion.calc_eta_pfd()
now includes
columns of names of efficiencies in its output.
This feature will assist pivoting on efficiencies later.footprint_aggregates()
calculates
primary and final demand aggregates
for each isolated row and column in Y.new_Y()
now also produced matrices
U_feed, U_eiou, and r_eiou
in its output.new_Y()
.
W can always be calculated from V^T - U.write_ecc_to_excel()
stores ECCs in spatial format in Excel.
All ECC matrices are written to the Excel file:
R, U, V, Y,
U_feed, U_eiou, r_eiou, and S_units.primary_aggregates()
and finaldemand_aggregates()
no longer require p_industries
and fd_sectors
to be present in the incoming list or data frame.
Rather, p_industries
and fd_sectors
are treated
as parameters that apply to all items in the incoming list
or rows in the incoming data frame.
This change brings consistency with other functions that
use matsindf::matsindf_apply()
internally.group_aggregates()
that
aggregates PSUT matrices according to an aggregation map.despecified_aggregates()
that
aggregates PSUT matrices to a piece of row and column labels. add_net_gross_cols
on primary_aggregates()
that tells
whether to add both net and gross primary energy columns.
(Net and gross primary energy aggregate columns will contain identical values,
but the presence of both net and gross columns may make it easier to mesh with
results from the finaldemand_aggregates()
function,
which produces net and gross columns that are different.)aggregate_regions()
now returns an empty data frame
with the expected columns if the input data frame
has no rows.matsbyname
is available
in aggregation functions.finaldemand_aggregates_with_units()
,
because nobody was using it.calc_eta_pfd()
calculates gross and net
efficiencies from primary to final demand.region_aggregates()
calculates
regional aggregates according to columns in a data frame.pkgdown
website.extend_to_exergy()
gains new arguments
mat_piece
, phi_piece
, notation
, and prepositions
to enable more flexible row and column name matching
between the various matrices and phi vectors.
In addition, extend_to_exergy()
now uses matsbyname::vec_from_store_byname()
internally to correctly handle hatized vector multiplication.Recca
vignette, including additional equations for embodied matrices. extend_to_exergy()
that calculates
an exergy representation of an energy conversion chain given
an energy representation of an energy conversion chain.new_R_ps_example.xlsx
that demonstrates
equations for swimming "downstream."if
statements to choose aggregation functions.
This change works around an error when calling the aggregation functions
from other packages.pattern_type
which tells how to match primary and final demand sector names for aggregation.finaldemand_aggregates()
and finaldemand_aggregates_with_units()
where argument fd_sectors
was not respected for gross energy aggregation.method_q_calculation
argument has been added to
the calc_io_mats()
function.
This enables to calculate the q vector using either
a consumption-side or supply-side perspective.find_p_industry_names()
looks at R, V, and Y matrices
to find names of primary industries (industries that produce primary energy).
The function looks for prefixes among row (R
and V
) and column (Y
) names
to identify primary industries.IEATools
package.IEATools
.finaldemand_aggregates()
primary_aggregates()
, finaldemand_aggregates(), and
finaldemand_aggregates_with_units()now require a column of
p_industriesor
fd_sectorsinstead of a vector
when a
.sutdatais a data frame.
This change works around a problem with a common use case where
the caller would create the
fd_sectorscolumn from the column names of
Y` vectors
in the data frame.`term`
instead of \code{term}
).Recca::sankey_cols$sankey
instead of "Sankey").calc_embodied_EIOU()
that calculates different embodied EIOU matrices for a given final demandcalc_erois()
that calculates different vector of product-level and industry-level EROIs
using different assumptions.calc_E_EIOU()
that calculates the E_EIOU
matrix of EIOU energy use
by unit of industry output, split by product.
It also calculates the direct energy extension vector e_EIOU of total EIOU energy use
by unit of industry output.U_excl_EIOU
to U_feed
.prep_UK2000.R
and prep_perfectsub.R
scripts
fixed to work with IEATools
, which now uses
U_feed
instead of U_excl_EIOU
.U_feed
everywhere.Z_feed
and A_feed
in calc_io_mats()
....
argument to make_sankey()
, which passes arguments to networkD3::sankeyNetwork()
.primary_aggregates()
.
primary_aggregates()
had been assuming that either the R or the V matrix (but not both)
could contain industries counted in total primary energy supply (production, imports, exports, etc.).
However, that is not true.
R is for resource industries, so
imports, exports, marine and aviation bunkers, and stock changes
are excluded from R.
However,
imports, exports, marine and aviation bunkers, and stock changes
are included in total primary energy supply.
I removed the conditional xor
check for appearance of TPES industries in R and V.
Everything seems to be working now.new_R_ps()
with its own tolerance, by default 1e-6
.R
matrices in the PSUT framework.
This effort involved converting several functions to accept either
1) both R and V matrices in the R
and V
arguments or
2) nothing supplied to the R
argument and R + V
supplied to the V
argument.openxlsx::read.xlsx()
that HTML-escapes referenced cells
that contain "&", "<", or ">".
See https://github.com/awalker89/openxlsx/issues/393 for details.openxlsx
package for reading data directly out of Excel files,
eliminating the need to export .csv files for the UKEnergy2000tidy data frame.primary_aggregates()
now properly handles PSUT matrices formulated with R
matrices.Recca.Rmd
vignette.qgraph
.
qgraph
depended upon graph
,
which is apparently no longer available on CRAN.
The dependency on qgraph
was only for graphical representations of ECCs.
But, graphical representations of ECCs are not presently implemented in Recca
.
Future versions of Recca
may implement graphical representations.
I can reassess the packages for graphing and Sankey diagrams
at a later date.group
ing on a column
of a data frame with NA
entries was causing a warning to be emitted.
Now, the grouping
happens after splitting the data frame into
rows with NA
entries and those without.
Grouping and sorting happens only for the rows without NA
values.create_sankey()
function, anyway.reverse()
function to change flow direction of an ECC.
reverse()
will be useful for downstream swim functions.resource_industries()
function.@importFrom
statements by fully-qualifying all function calls.new-functions
vignette now complete, including demonstrations of
new_R_ps()
and new_k_ps()
functions.make_sankey()
does what it says: makes a Sankey diagram.
make_sankey()
is the first function that optionally uses the resource (R
) matrix.edge_list()
also now accepts a resource (R
) matrix on input.new*()
functions now has a section on new_R_ps()
.calc_F_footprint_effects()
now cleans rows and columns
(deletes rows and columns containing all 0s)
before calculating row and column fractions.calc_F_footprint_effects()
now calculates row and column fractions
using matsbyname::fractionize_byname()
,
providing a speed boost.new_*
functions.matsbyname::hatinv_byname()
which handles 0
values better.magrittr
pipe at high level.matsbyname::hatinv_byname()
function
instead of matsbyname::hatize_byname() %>% matsbyname::invert_byname()
.Recca
functions are no longer named *_colname
.
I'm standardizing argument names.
The new approach yields better code when calling functions with individual matrices:
every matrix needs to be named.
And when using functions to operate on a data frame the default values for column names
mean that data frames can be piped to functions that are called with no parameters.
Furthermore, this change allows lists output from previous functions
to be used in later function calls without name changes.
For example, f1
produces a list l
with named item z
, and
z
is an input to f2
.
The previous naming convention would require user mapping z
to z_colname
:
f2(z_colname = l$z)
.
The new naming convention allows
f2(l)
, because l
contains named item z
, and f2
has an argument new named z
(where it had been named z_colname
before).
In all ways, the new argument naming convention is more elegant than the previous *_colname
approach.reconstruct_UV()
--> new_Y()
.
This change allows for several new_*()
functions that assess changes to the ECC
when some part of the ECC changes.new_k_ps()
assesses changes to the ECC when
proportion of inputs to an industry change
under the assumption of perfect substitution.products_unit_homogeneous()
, inputs_unit_homogeneous()
, and outputs_unit_homogeneous()
test whether products, inputs to all industries, and outputs from all industries are unit-homogeneous.node_list
which creates a node list from an edge list.edge_list
which creates an edge list from U, V, and Y matrices.verify_IEATable_energy_balance
.
err
--> as.name(err)
.S_units_from_tidy
.
Needed to change an argument name for matsindf::collapse_to_matrices
from values
--> matvals
.verify_SUT_industry_production
that
indicates which industries are problematic.verify_IEATable_energy_balance
function: !!err --> !!as.name(err)verify_IEATable_energy_balance
functionmatsindf::matsindf_apply()
.F
functions now do internal energy balance checks.*_colname
arguments.calc_io_mats
:
calculate input-output (PSUT version) matrices, including y, q, g, W,
Z, D, C, A, L_ixp, and L_pxp.reconstruct_UV()
:
Reconstruct the energy conversion chain (new U
and V
matrices) from a new final demand matrix (Y
)UKEnergy2000tidy
, UKEnergy2000mats
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.