Closed nikolas-burkoff closed 2 years ago
Example not requiring tmc:
library(scda)
library(dplyr)
library(teal)
adsl <- synthetic_cdisc_data("latest")$adsl
adex <- synthetic_cdisc_data("latest")$adex
set.seed(1, kind = "Mersenne-Twister")
adex <- adex %>%
distinct(USUBJID, .keep_all = TRUE) %>%
mutate(
PARAMCD = "TDURD",
PARAM = "Overall duration (days)",
AVAL = sample(x = seq(1, 200), size = n(), replace = TRUE),
AVALU = "Days"
) %>%
bind_rows(adex)
data <- cdisc_data(
cdisc_dataset("ADSL", adsl, code = 'ADSL <- synthetic_cdisc_data("latest")$adsl'),
cdisc_dataset("ADEX", adex, code = 'ADEX <- synthetic_cdisc_data("latest")$adex
set.seed(1, kind = "Mersenne-Twister")
ADEX <- ADEX %>%
distinct(USUBJID, .keep_all = TRUE) %>%
mutate(PARAMCD = "TDURD",
PARAM = "Overall duration (days)",
AVAL = sample(x = seq(1, 200), size = n(), replace = TRUE),
AVALU = "Days") %>%
bind_rows(ADEX)'),
check = TRUE
)
app <- init(
data = data,
modules = modules(
module(
"simple show r code",
server = function(id, datasets) {
moduleServer(id, function(input, output, session) {
teal.code::init_chunks()
output$text <- renderText("Text here")
teal::get_rcode_srv(
id = "rcode",
datasets = datasets,
datanames = c("ADSL", "ADEX"),
modal_title = "R Code",
code_header = "R Code"
)
})
},
ui = function(id, datasets) {
ns <- NS(id)
teal.widgets::standard_layout(
output = textOutput(ns("text")),
forms = teal::get_rcode_ui(ns("rcode"))
)
},
filters = "all",
)
)
)
runApp(app)
This has check = TRUE (and the reproducibility check does run - change the seed from 1 to 10 in the code argument) but you still see
Note also https://github.com/insightsengineering/teal.modules.clinical/issues/405