pharmaverse / pharmaverse/rtables

Coexistence of trim_levels_to_map() and add_combo_levels().

Open
#1,097 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
260
Forks
53
PR merge metrics
No merged PRs in 30d

Description

Is there any reason why the STUDYID column in the map is ignored in the layout below?

map <- tribble(
  ~ARM, ~STUDYID,
  "A: Drug X", "n",
  "B: Placebo", "mean"
)

combo_df <- tribble(
  ~valname, ~label, ~levelcombo, ~exargs,
  "n", "n", select_all_levels, list(),
  "mean", "mean", select_all_levels, list(),
)

lyt <- basic_table() |>
  split_cols_by("ARM", split_fun = trim_levels_to_map(map)) |>
  split_cols_by("STUDYID", split_fun = add_combo_levels(combo_df)) |>
  analyze("BMRKR1", afun = simple_analysis)

tbl <- build_table(lyt, ex_adsl)
tbl
        A: Drug X      B: Placebo  
         n     mean     n     mean 
———————————————————————————————————
Mean   5.97    5.97   5.70    5.70 

Contributor guide

Open the contributing guide

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.

Research direction

Search the implementations and tests for trim_levels_to_map() and add_combo_levels(), then run the reproducible layout using ex_adsl. Trace how the STUDYID map values are handled during build_table(); done means the interaction is explained and, if unintended, covered by a regression test and corrected behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.