Closed jacobvjk closed 4 months ago
@jdhoffa @MonikaFu I am still keeping this in draft mode, as we probably want to agree on the linked PR first. But it may make sense to take a brief look at this PR now as well. Explanation is above, but just a quick tl;dr:
the aggregate metric needs to be flexible for analysis, allowing slicing and dicing of the loan books by user defined variables (e.g. by banks, but possibly also by membership in alliances, loan structures, etc). The prep and plot functions should cover this in a basic way but could probably use some prettification. open to ideas and suggestions here
Ah this might be a bit of an anti-pattern.
Specifically for the prep_
and plot_
functions, I would tend to prefer that they always expect a single unit of input to prep
or plot
(so as to not overcomplicate them). And if iterating over groups is desired, I would imagine doing that either in:
workflow.*
is probably desired?
I don't think hard-baking the grouping functionality into the plotting functions is a good idea...
Ah this might be a bit of an anti-pattern.
Specifically for the
prep_
andplot_
functions, I would tend to prefer that they always expect a single unit of input toprep
orplot
(so as to not overcomplicate them). And if iterating over groups is desired, I would imagine doing that either in:
- the
workflow.*
- some wrapper function
- a vignette
is probably desired?
I don't think hard-baking the grouping functionality into the plotting functions is a good idea...
It's definitely not pretty at this point and it may be worth reviewing which of the plots realisitically need to show any group information. But I think in some cases we explicitly want the group info inside the plot. See e.g. https://github.com/RMI-PACTA/workflow.aggregate.loanbooks/pull/95
more generally: the group will - at least in most cases - be used as an aesthetic (in ggplot terms). So iterating over the groups will likely not do it
Ok got it, then totally fair enough!
depends on https://github.com/RMI-PACTA/pacta.multi.loanbook.analysis/pull/34 closes #27 closes #25 by coincidence
pacta.multi.loanbook.plot
package to changes made inpacta.multi.loanbook.analysis
, which now allows aggregating results by any user defined variableprep_*()
andplot_*()
functions gain flexibility in processing grouping variables"group_id"
, the variable can now be specified to any name using thegroup_var
argumentpacta.multi.loanbook.analysis
remove the need to use thematched_prioritized
data set as an input to the sankey plot. this means thatpacta.multi.loanbook.plot
now solely uses data objects created withpacta.multi.loanbook.analysis
group_var
in function signature, changingcategory
togroup_var
inprep_scatter_alignment_exposure()
andplot_scatter_alignment_exposure()
"bank"
in scatter plots are changed to"group"
anddata_level
can now be"company"
or"group_var"
, not"bank"