Fixes failing "Add to Report" for modules that have DT table visualization#900
Merged
averissimo merged 23 commits intomainfrom Aug 8, 2025
Merged
Fixes failing "Add to Report" for modules that have DT table visualization#900averissimo merged 23 commits intomainfrom
DT table visualization#900averissimo merged 23 commits intomainfrom
Conversation
DT table visualization
Contributor
Unit Tests Summary 1 files 22 suites 1s ⏱️ Results for commit 98d2f17. ♻️ This comment has been updated with latest results. |
Contributor
Code Coverage SummaryDiff against mainResults for commit: 98d2f17 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
averissimo
commented
Jul 25, 2025
averissimo
commented
Aug 5, 2025
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the "Add to Report" functionality for modules that use DT table visualizations by migrating from DT datatables to rtables format. The key issue was that modules using interactive DataTables couldn't properly export decorated tables to reports.
- Replaces
DT::datatable()withrtables::df_to_tt()for creating decoratable table objects - Updates documentation to clarify that decorated tables appear in reports while interactive DataTables remain in the module UI
- Improves variable naming to distinguish between raw data frames and table objects
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/tm_outliers.R | Migrates table creation from DT to rtables, improves variable naming from summary_table_pre to summary_data_pre |
| R/tm_missing_data.R | Converts table generation to use rtables format for decorator compatibility |
| R/tm_g_distribution.R | Updates both summary and test tables to use rtables, adds proper empty table handling |
| R/tm_g_bivariate.R | Minor cleanup removing unused library import |
| man/*.Rd | Updates documentation to reflect rtables usage and clarify decorator behavior |
| NEWS.md | Documents the bug fix for "Add to Report" functionality |
Contributor
|
Tested with devtools::load_all("teal.code")
devtools::load_all("teal.data")
devtools::load_all("teal.transform")
devtools::load_all("teal.logger")
devtools::load_all("teal.reporter")
devtools::load_all("teal.widgets")
devtools::load_all("teal")
devtools::load_all("teal.modules.general")
data <- teal_data()
data <- within(data, {
require(nestcolor)
add_nas <- function(x) {
x[sample(seq_along(x), floor(length(x) * runif(1, .05, .17)))] <- NA
x
}
iris <- iris
mtcars <- mtcars
iris[] <- lapply(iris, add_nas)
mtcars[] <- lapply(mtcars, add_nas)
mtcars[["cyl"]] <- as.factor(mtcars[["cyl"]])
mtcars[["gear"]] <- as.factor(mtcars[["gear"]])
CO2 <- CO2
CO2[["primary_key"]] <- seq_len(nrow(CO2))
})
join_keys(data) <- join_keys(join_key("CO2", "CO2", "primary_key"))
vars <- choices_selected(variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")))
app <- init(
data = data,
modules = modules(
tm_missing_data(parent_dataname = "mtcars"),
tm_g_distribution(
dist_var = data_extract_spec(
dataname = "iris",
select = select_spec(variable_choices("iris"), "Petal.Length")
)
),
tm_outliers(
outlier_var = list(
data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]], c("conc", "uptake")),
selected = "uptake",
multiple = FALSE,
fixed = FALSE
)
)
),
categorical_var = list(
data_extract_spec(
dataname = "CO2",
filter = filter_spec(
vars = vars,
choices = value_choices(data[["CO2"]], vars$selected),
selected = value_choices(data[["CO2"]], vars$selected),
multiple = TRUE
)
)
)
)
)
)
shinyApp(app$ui, app$server)
and I was able to add card to the report in all 3 modules Recording.2025-08-05.131354.mp4 |
m7pr
approved these changes
Aug 5, 2025
averissimo
commented
Aug 5, 2025
averissimo
commented
Aug 5, 2025
averissimo
commented
Aug 8, 2025
vedhav
approved these changes
Aug 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pull Request
DataTabletables #899Changes description
rtables::df_to_ttto produce report tables (that are decoratable)data(raw data frame) fromtable(rtable or DT))