Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Error from the `var =...` in `define_population` and `define_observation`

Open
#137 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
r
Domain
data

Research direction

Reproduce the supplied example, focusing on the var arguments passed to define_population() and define_observation(). Read those function entry points and the related metadata-building path to identify why including var causes the failure; done means the example works without removing either var argument.

Written by the indexing model from the issue text.

Description

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()

Dominant language
R
Stars
22
Forks
6
Avg merge
1d 14h
Merged PRs (30d)
10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Merck/forestly

All issues in Merck/forestly

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.