pharmaverse / pharmaverse/rtables

`child_labels` ignored by `split_rows_by_cutfun()`

Open
#1,104 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

child_labels = "hidden" works with split_rows_by(), but is ignored by split_rows_by_cutfun().

Works as expected with split_rows_by()
dat <- DM
dat$AGEGRMED <- ifelse(DM$AGE <= median(DM$AGE), "Younger", "Older")

lyt <- basic_table() |>
  split_rows_by("AGEGRMED", child_labels = "hidden") |>
  analyze("BMRKR1", mean, format = "xx.xx")

tbl <- build_table(lyt, dat)
tbl
all obs
——————————————
mean    6.09
mean    5.65
child_labels is ignored by split_rows_by_cutfun()
cutfun <- function(x) {
  cutpoints <- c(min(x), mean(x), max(x))
  names(cutpoints) <- c("", "Younger", "Older")
  cutpoints
}

lyt2 <- basic_table() |>
  split_rows_by_cutfun("AGE", cutfun = cutfun, child_labels = "hidden") |>
  analyze("BMRKR1", mean, format = "xx.xx")

tbl2 <- build_table(lyt2, dat)
tbl2
all obs
———————————————————
AGE
  Younger
    mean     5.83
  Older
    mean     5.88

It is important that child_labels = "hidden" is not ignored, particularly when the afun creates the row label.

The label_pos = "hidden" is also ignored by split_rows_by_cutfun()....

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

Start at the split_rows_by_cutfun() entry point and compare its handling of child_labels and label_pos with split_rows_by(). Reproduce the supplied AGE and cutfun examples, then verify that both options are honored, including when the afun creates the row label.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.