Skip to content

[Bug]: tm_t_summary() show NA values when they should be omitted #1437

@llrs-roche

Description

@llrs-roche

What happened?

Output doesn't respect the option to show and hide NAs.
This was first reported internally by one user for tm_t_summary() and tm_t_summary_by().

This might be related to using df_explicit_na() inside the module, that forces all NAs to be present as a new factor.

data <- within(teal_data(), {
  ADSL <- tmc_ex_adsl
  ADSL$EOSDY[1] <- NA_integer_
  ind <- 1:100
  ADSL$SEX[ind] <- NA
  # Get code::
  set.seed(1000)
  ind <- sample(seq_len(nrow(ADSL)), 100)
  ADSL$RACE[ind] <- NA
})
join_keys(data) <- default_cdisc_join_keys[names(data)]

app <- init(
  data = data,
  modules = modules(
    tm_t_summary(
      label = "Demographic Table",
      dataname = "ADSL",
      arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
      add_total = TRUE,
      summarize_vars = choices_selected(
        c("SEX", "RACE", "BMRKR2", "EOSDY", "DCSREAS", "AGE"),
        c("SEX", "RACE")
      ),
      useNA = "ifany"
    ),
    tm_t_summary_by(
      label = "Summary by Row Groups Table",
      dataname = "ADSL",
      arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
      add_total = TRUE,
      summarize_vars = choices_selected(
        choices = variable_choices("ADSL", c('EOSDY')),
        selected = c('EOSDY')
      ),
      by_vars = choices_selected(
        c("SEX", "RACE", "BMRKR2", "EOSDY", "DCSREAS", "AGE"),
        c("SEX", "RACE")
      ),
      useNA = "ifany"
    )
  )
) |> runApp()

sessionInfo()

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions