MUCollective / multiverse

R package for creating explorable multiverse analysis
https://mucollective.github.io/multiverse/
GNU General Public License v3.0
62 stars 5 forks source link

Error message for undefined parameters #115

Closed abhsarma closed 2 months ago

abhsarma commented 2 years ago

Currently the error messages for a parameter which has not been defined yet is unintuitive. Consider:

df = data.raw.study2 %>%
    mutate( ComputedCycleLength = StartDateofLastPeriod - StartDateofPeriodBeforeLast ) %>%
    mutate(NextMenstrualOnset = branch(menstrual_calculation,
        "mc_option1" %when% (cycle_length != "cl_option3") ~ StartDateofLastPeriod + ComputedCycleLength,
        "mc_option2" %when% (cycle_length != "cl_option2") ~ StartDateofLastPeriod + ReportedCycleLength,
        "mc_option3" ~ StartDateNext)
    )

If the cycle_length parameter has not been defined previously, then we correctly get an error message, but the message is not intuitive and the message is only displayed in the console (not underneath the code block):