Skip to content

Error from the var =... in define_population and define_observation #137

Description

@LittleBeannie

The following code doesn't work. If I get rid of var = ... from define_population() and define_observation(), it works.

adsl <- forestly_adsl # SITEID is included in ADSL
adae <- forestly_adae # SITEID is not included in ADAE

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

meta <- meta_adam(population = adsl, observation = adae) |>
  define_plan(plan = plan(
    analysis = "ae_forestly",
    population = "apat",
    observation = "apat",
    parameter = "any;drug-related"
  )) |>
  define_analysis(name = "ae_forestly", label = "Interactive Forest Plot") |>
  define_population(
    name = "apat", group = "TRTA", id = "USUBJID",
    subset = SAFFL == "Y", label = "All Patient as Treated",
    var = c("USUBJID", "SAFFL", "SITEID", "AGE", "SEX")
  ) |>
  define_observation(
    name = "apat", group = "TRTA",
    subset = SAFFL == "Y", label = "All Patient as Treated",
    var = c("USUBJID", "SAFFL","TRTA", "AEDECOD", "AEBODSYS", "AREL")
  ) |>
  define_parameter(
    name = "any",
    subset = NULL,
    label = "Any AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  define_parameter(
    name = "drug-related",
    subset = toupper(AREL) == "RELATED",
    label = "Drug-related AEs",
    var = "AEDECOD", soc = "AEBODSYS"
  ) |>
  meta_build()

meta |>
  prepare_ae_forestly(ae_listing_display = c("USUBJID", "SITEID", "SEX", "RACE", "AGE")) |>
  format_ae_forestly() |>
  ae_forestly()

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