Align Dose (Stressor Magnitude) Names with Stressor-Response Names
Source:R/align_dose_stressor_names.R
align_dose_stressor_names.RdRenames stressor magnitude rows to the full
"<Stressor>_<Stressor_cat>" form when - and only when - the
stressor-response workbook uses those concatenated names.
Arguments
- dose
Data frame. Stressor magnitude data (from
StressorMagnitudeWorkbook).- sr_names
Character vector of (final) stressor names from the stressor-response workbook main sheet.
Details
StressorResponseWorkbook() resolves duplicate stressor names by
renaming rows to "<Stressor>_<Stressor_cat>" when each copy carries a
distinct, non-blank Stressor_cat. The stressor magnitude workbook keeps
its short names on load (legacy workbooks legitimately repeat a stressor
name across component rows that feed a single curve), so this helper
aligns the two at model run time. A dose row is renamed only when its
short name does NOT match any stressor-response name AND the concatenated
name DOES. Rows whose short name already matches (including legacy
component-row workbooks) are left untouched, as are rows tagged with the
reserved category "Total_Mortality". A warning is issued whenever
Stressor_cat is used to resolve a name, as this is expected to be rare.
Called automatically by JoeModel_Run and
PopulationModel_Run.