-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce decorators for tm_a_gee
#1259
Introduce decorators for tm_a_gee
#1259
Conversation
…tsengineering/teal.modules.clinical into 1187_decorate_output@main
✅ All contributors have signed the CLA |
@llrs-roche you need to reply with I have read the CLA Document and I hereby sign the CLA |
@llrs-roche please add sprint |
@llrs-roche you are missing ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", a$decorators)), |
Just go by another PR and copy paste all the new lines |
I have read the CLA Document and I hereby sign the CLA |
Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> Signed-off-by: Lluís Revilla <185338939+llrs-roche@users.noreply.github.com>
…om/insightsengineering/teal.modules.clinical into tm_a_gee@1187_decorate_output@main
…om/insightsengineering/teal.modules.clinical into tm_a_gee@1187_decorate_output@main
@llrs-roche I left 2 more comments. Please provide a working app in the opening of this PR. Once you are done with the working example, please make this ready for the review and I will review. |
I am trying to create a working example for this one devtools::load_all("../teal.reporter")
devtools::load_all("../teal")
devtools::load_all(".")
insert_rrow_decorator <- function(default_caption = "I am a good new row", .var_to_replace = "table") {
teal_transform_module(
label = "New row",
ui = function(id) shiny::textInput(shiny::NS(id, "new_row"), "New row", value = default_caption),
server = make_teal_transform_server(
substitute({
.var_to_replace <- rtables::insert_rrow(.var_to_replace, rtables::rrow(new_row))
}, env = list(.var_to_replace = as.name(.var_to_replace)))
)
)
}
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADQS <- tmc_ex_adqs %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
mutate(
AVISIT = as.factor(AVISIT),
AVISITN = rank(AVISITN) %>%
as.factor() %>%
as.numeric() %>%
as.factor(),
AVALBIN = AVAL < 50 # Just as an example to get a binary endpoint.
) %>%
droplevels()
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_a_gee(
label = "GEE",
dataname = "ADQS",
aval_var = choices_selected("AVALBIN", fixed = TRUE),
id_var = choices_selected(c("USUBJID", "SUBJID"), "USUBJID"),
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
visit_var = choices_selected(c("AVISIT", "AVISITN"), "AVISIT"),
paramcd = choices_selected(
choices = value_choices(data[["ADQS"]], "PARAMCD", "PARAM"),
selected = "FKSI-FWB"
),
cov_var = choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL),
decorators = list(insert_rrow_decorator("Hello world", "table"))
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
|
Hey @llrs-roche I've got no idea what's wrong on this branch. I spent 45 minutes trying to improve, but lastly decided to do it from scratch on another PR where it worked. Please close this one, review the one that I provided #1262 |
On one side, I'm happy it was not just me but on the other side, I'm not sure how I broke it so much. Closing it |
), | ||
forms = tagList( | ||
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code") | ||
), | ||
pre_output = a$pre_output, | ||
post_output = a$post_output | ||
) | ||
a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@llrs-roche this is the issue that broke this branch
Part of insightsengineering/teal#1371
Working example (WIP)
App