Repository navigation
Carry the currency of a psa object through to its analyses (#203) - #242
Merged
Merged
Conversation
- ceac(), calc_exp_loss(), calc_evpi(), calc_evppi(), calc_evsi(), and calculate_icers_psa() store psa$currency on their results. - Their plot() methods (and print.icers()) use it: currency defaults to NULL, resolved by resolve_currency() as the argument if given, else the result's currency, else '$'. Existing calls keep working. - plot.ceac() gains effect_units (the x-axis label hard-coded QALY). - EVPPI and EVSI computed from net health benefit are in health units: calc_evppi() and calc_evsi() store the outcome, and their plots are labeled 'EVPPI (QALY)' / 'EVSI (QALY)' instead of a currency. calc_evsi() defaults to outcome = 'nhb', so its default plot was mislabeled in dollars. - Tests (test_currency.R) with a euro PSA for every function, overrides, effect_units, and dollar defaults; two existing tests now build the expected object with the same currency. Outputs of all vignettes and examples change only by the new currency attribute; values, plot data, and labels are unchanged. Closes #203
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #203
The problem (#203)
make_psa_obj(..., currency = "€")stored the currency, but onlyplot.psa()used it. Every other analysis and plot defaulted to a hard-coded"$", so users had to passcurrency =to each plot.What changed
ceac(),calc_exp_loss(),calc_evpi(),calc_evppi(),calc_evsi()andcalculate_icers_psa()keeppsa$currencyon their results.plot()method (andprint.icers()),currencynow defaults toNULL, which resolves to the argument if given, else the result's currency, else"$". Positional calls are unaffected, and an explicitcurrency =still overrides.plot.ceac()gainseffect_units. Its x-axis label had "QALY" hard-coded.outcome = "nhb") are in QALYs, so their plots now read "EVPPI (QALY)" and "EVSI (QALY)". This also fixes a mislabeling:calc_evsi()defaults tooutcome = "nhb", so its default plot said "EVSI ($)" for a value in QALYs.Tests
New
test_currency.Rbuilds a PSA in euros and checks, for every affected function:currency = "£"overrides it,effect_unitsworks inplot.ceac(),Two existing tests now build their expected object with the same currency.
Verification
R CMD check --as-cran: 0 errors, 0 warnings, 1 NOTE (the development version number).outcome = "nmb", so their labels stay in currency.)Not changed
run_owsa_det()andrun_twsa_det()don't gain acurrencyargument: their OWSA/TWSA results and plots never show a currency.