Skip to content

Cause an error when non-existing columns are selected in collect_observation_record(var=...) #181

Description

@fukuhiro2023

The following code returns an error because "AGEU" is not included in meta$data_observation. It would be better to raise an error message for this situation.

library(metalite)
library(forestly)
adsl <- forestly_adsl
adae <- forestly_adae
adsl$TRTA <- factor(adsl$TRTA, levels = c("Placebo", "Xanomeline Low Dose"))
adae$TRTA <- factor(adae$TRTA, levels = c("Placebo", "Xanomeline Low Dose"))


meta <- meta_adam(population = adsl, observation = adae) |>
  define_plan(plan = plan(analysis = "ae_forest_plot",
                          population = "apat",
                          observation = "oapat",
                          parameter = "any-AE"           
  )) |>
  define_population(name = "apat",
                    group = "TRTA",
                    subset = SAFFL == "Y" ,
                    label = "All Participants as Treated Population",
                    var = c("USUBJID", "TRTA", "RACE", "SEX", "AGE", "AGEU")) |>
  define_observation(name = "oapat",
                     group = "TRTA",
                     subset = SAFFL == "Y" ,
                     label = "All Participants as Treated Population") |>
  define_analysis(name = "ae_forest_plot",
                  label = "Interactive AE Forest Plot") |>
  define_parameter(name = "any-AE",
                   subset = SAFFL == "Y",
                   label = "Any AEs",
                   var = "AEDECOD", soc = "AEBODSYS", term1 = "", term2 = "") |>
  meta_build()

collect_observation_record(meta, "apat", "oapat", "any-AE", var = c("USUBJID", "TRTA", **"AGEU"**))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions