Here what I captured from a meeting with @jdhoffa on 2020-02-24
Issue
New add_weighted_production() adds column weighted_production -- short for sum_of_weighted_production_by_sector_by_technology_by_year.
User story
As an analyst I want to have a function add_weighted_production(). add_weighted_production() takes a matched dataset (i.e. the output of match_name(porfolio, ald)) and adds the the column weighted_production which aggregates the weighted production off all loans for each sector, tecnology, and year.
The weighted production should be calculated as the loan_size* / sum(loan_size*_by_sector), where loan_size* defaults to loan_size_outstandings but could optionally be loan_size_limit.
Draft signature
data: Dataframe, commonly the output of prioritize(match_name()).
loan_size: String of length-1; either "loan_size_outstandings" (default) or
"loan_size_credit_limit".
Here what I captured from a meeting with @jdhoffa on 2020-02-24
Issue
New
add_weighted_production()
adds columnweighted_production
-- short forsum_of_weighted_production_by_sector_by_technology_by_year
.User story
As an analyst I want to have a function
add_weighted_production()
.add_weighted_production()
takes a matched dataset (i.e. the output ofmatch_name(porfolio, ald)
) and adds the the columnweighted_production
which aggregates the weighted production off all loans for each sector, tecnology, and year.The weighted production should be calculated as the
loan_size* / sum(loan_size*_by_sector)
, whereloan_size*
defaults toloan_size_outstandings
but could optionally beloan_size_limit
.Draft signature
data
: Dataframe, commonly the output ofprioritize(match_name())
.loan_size
: String of length-1; either "loan_size_outstandings" (default) or "loan_size_credit_limit".Draft implementation
loan_size*
: The asterisk*
reflects that it could be any of the valid inputs to theloan_size
argument.Assert
Crucial columns:
production_units
must be consistent within any sector, but we don't care what units they are. Reuse internalcheck_units()
(or similar).Input has crucial columns.
loan_size* is numeric
In
loan_size / sum_of_loan_size_by_sector
, dividend is validTest ideas
portfolio_weighted_production_by_sector_technology_year
portfolio_weighted_production_by_sector_technology_year
makes senseweighted_production
(i.e. short forportfolio_weighted_production_by_sector_technology_year
).