Skip to content

child_labels ignored by split_rows_by_cutfun() #1104

Description

@wwojciech

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

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