insightsengineering / teal.slice

Reproducible slice module for teal applications
https://insightsengineering.github.io/teal.slice/
Other
11 stars 5 forks source link

[Bug]: Date columns with NA cause an error #581

Closed gogonzo closed 3 months ago

gogonzo commented 3 months ago

What happened?

options(teal.log_level = "TRACE", teal.show_js_log = TRUE)
library(teal)
library(shiny)
library(scda)

ADSL <- synthetic_cdisc_data("latest")$adsl
ADSL$date <- sample(Sys.Date() + 1:5, size = nrow(ADSL), replace = TRUE)
ADSL$datetime <- sample(Sys.time() + (1:5) * 3600, size = nrow(ADSL), replace = TRUE)

ADSL$date[sample(1:nrow(ADSL), size = 10, )] <- NA
ADSL$datetime[sample(1:nrow(ADSL), size = 10, )] <- NA

ADTTE <- synthetic_cdisc_data("latest")$adtte
ADRS <- synthetic_cdisc_data("latest")$adrs

pkgload::load_all("teal.slice")
app <- init(
  data = teal_data(ADSL = ADSL, ADTTE = ADTTE, ADRS = ADRS),
  modules = list(example_module()),
  filter = teal_slices(
    teal_slice("ADSL", "date", choices = unique(sort(ADSL$date))[2:3]),
    teal_slice("ADSL", "datetime", choices = unique(sort(ADSL$datetime))[2:3]),
    count_type = "all"
  )
)

runApp(app)

sessionInfo()

No response

Relevant log output

No response

Code of Conduct

Contribution Guidelines

Security Policy