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

A bug of `prepare_boxly`

Open
#45 1 comment 0 reactions 1 assignee View on GitHub

@fukuhiro2023 is already working on this.

Since Nov 26, 2025.

Assessment

This issue has not been assessed yet.

Description

The following code works.

adsl <- r2rtf::r2rtf_adsl |> 
  filter(TRT01P %in% c("Placebo", "Xanomeline High Dose")) |>
  mutate(TRT01P = factor(TRT01P,
                         levels = c("Placebo", "Xanomeline High Dose"),
                         labels = c("Control", "Experimental")),
         TRT01A = factor(TRT01A,
                         levels = c("Placebo", "Xanomeline High Dose"),
                         labels = c("Control", "Experimental")),
         RACE = stringr::str_to_sentence(RACE))

adlb <- boxly_adlb |> 
  filter(TRTA %in% c("Placebo", "Xanomeline High Dose")) |>
  mutate(TRTA = factor(TRTA,
                       levels = c("Placebo", "Xanomeline High Dose"),
                       labels = c("Control", "Experimental"))) |>
  rename(TRT01A = TRTA)

meta_lab <- meta_adam(population = adsl,
                      observation = adlb) |>
  define_plan(plan = plan(analysis = "lab_boxplot",
                          population = "apat",
                          observation = "wk12",
                          parameter = "alp;alt;bili;sodium;urate")) |>
  define_population(name = "apat",
                    group = "TRT01A",
                    subset = SAFFL == "Y",
                    label = "APaT Population") |>
  define_observation(name = "wk12",
                     group = "TRT01A",
                     var = "PARAM",
                     subset = SAFFL == "Y",
                     label = "") |>
  define_analysis(name = "lab_boxplot",
                  label = "Interactive Box Plot",
                  x = "AVISITN", 
                  y = "CHG") |>
  define_parameter(name = "alp",
                   label = "Alanine Aminotransferase (U/L)",
                   subset = PARAM == "Alanine Aminotransferase (U/L)") |>
  define_parameter(name = "alt",
                   label = "Alkaline Phosphatase (U/L)",
                   subset = PARAM == "Alkaline Phosphatase (U/L)") |>
  define_parameter(name = "bili",
                   label = "Bilirubin (umol/L)",
                   subset = PARAM == "Bilirubin (umol/L)") |>
  define_parameter(name = "sodium",
                   label = "Sodium (mmol/L)",
                   subset = PARAM == "Sodium (mmol/L)") |>
  define_parameter(name = "urate",
                   label = "Urate (umol/L)",
                   subset = PARAM == "Urate (umol/L)") |>
  meta_build()

meta_lab |>
  prepare_boxly(population = "apat",
                observation = "apat",
                analysis = "lab_boxplot") |>
  boxly()

> metalite::collect_adam_mapping(meta_lab, "wk12")$var
[1] "PARAM"

However, if I change the observation to "apat", then it breaks!

meta_lab <- meta_adam(population = adsl,
                      observation = adlb) |>
  define_plan(plan = plan(analysis = "lab_boxplot",
                          population = "apat",
                          observation = "apat",
                          parameter = "alp;alt;bili;sodium;urate")) |>
  define_population(name = "apat",
                    group = "TRT01A",
                    subset = SAFFL == "Y",
                    label = "APaT Population") |>
  define_observation(name = "apat",
                     group = "TRT01A",
                     var = "PARAM",
                     subset = SAFFL == "Y",
                     label = "APaT Population") |>
  define_analysis(name = "lab_boxplot",
                  label = "Interactive Box Plot",
                  x = "AVISITN", 
                  y = "CHG") |>
  define_parameter(name = "alp",
                   label = "Alanine Aminotransferase (U/L)",
                   subset = PARAM == "Alanine Aminotransferase (U/L)") |>
  define_parameter(name = "alt",
                   label = "Alkaline Phosphatase (U/L)",
                   subset = PARAM == "Alkaline Phosphatase (U/L)") |>
  define_parameter(name = "bili",
                   label = "Bilirubin (umol/L)",
                   subset = PARAM == "Bilirubin (umol/L)") |>
  define_parameter(name = "sodium",
                   label = "Sodium (mmol/L)",
                   subset = PARAM == "Sodium (mmol/L)") |>
  define_parameter(name = "urate",
                   label = "Urate (umol/L)",
                   subset = PARAM == "Urate (umol/L)") |>
  meta_build()

> metalite::collect_adam_mapping(meta_lab, "apat")$var
NULL
Dominant language
R
Stars
14
Forks
2
PR merge metrics
No merged PRs in 30d

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/boxly

All issues in Merck/boxly

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.