Skip to content

Conversation

llrs-roche
Copy link
Contributor

Pull Request

Fixes #495

Replaces the table by a plot on "By Variables Levels" tab.
The colors match those in the other plots of the module.
It also required to add a "new" dependency, formatters, which is a dependency of tern, rlistings, rtable. I added it on Suggests.

There is an extra commit to update the lintr names

data <- within(teal_data(), {
  ADSL <- rADSL
  ADRS <- rADRS
})
join_keys(data) <- default_cdisc_join_keys[names(data)]

init(
  data = data,
  modules = modules(tm_missing_data())
) |> runApp()

@llrs-roche llrs-roche added the core label Oct 3, 2025
Copy link
Contributor

github-actions bot commented Oct 3, 2025

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  -------------------------------------------
R/tm_a_pca.R                    876     876  0.00%    141-1147
R/tm_a_regression.R             762     762  0.00%    180-1041
R/tm_data_table.R               200     200  0.00%    100-348
R/tm_file_viewer.R              172     172  0.00%    47-254
R/tm_front_page.R               143     132  7.69%    77-246
R/tm_g_association.R            331     331  0.00%    161-561
R/tm_g_bivariate.R              681     417  38.77%   332-801, 842, 953, 970, 988, 999-1021
R/tm_g_distribution.R          1116    1116  0.00%    154-1414
R/tm_g_response.R               356     356  0.00%    179-608
R/tm_g_scatterplot.R            720     720  0.00%    261-1079
R/tm_g_scatterplotmatrix.R      283     264  6.71%    200-515, 576, 590
R/tm_missing_data.R            1167    1167  0.00%    126-1474
R/tm_outliers.R                1032    1032  0.00%    163-1348
R/tm_t_crosstable.R             273     273  0.00%    177-494
R/tm_variable_browser.R         788     783  0.63%    89-1025, 1063-1246
R/utils.R                       185     120  35.14%   87-249, 278-304, 316-325, 330, 344-363, 452
R/zzz.R                           2       2  0.00%    2-3
TOTAL                          9087    8723  4.01%

Diff against main

Filename               Stmts    Miss  Cover
-------------------  -------  ------  --------
R/tm_g_bivariate.R        -4      -4  +0.23%
R/tm_missing_data.R      +68     +68  +100.00%
TOTAL                    +64     +64  -0.03%

Results for commit: c296936

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

github-actions bot commented Oct 3, 2025

Unit Tests Summary

  1 files  23 suites   2s ⏱️
151 tests 36 ✅ 115 💤 0 ❌
194 runs  79 ✅ 115 💤 0 ❌

Results for commit c296936.

♻️ This comment has been updated with latest results.

teal.reporter::teal_card("## Module's code")
)
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("tidyr")') # nolint: quotes
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("tidyr")') # nolint: quotes_lintr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the quotes for all of these :-)

Suggested change
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("tidyr")') # nolint: quotes_lintr
teal.code::eval_code(obj, "library(ggplot2);library(dplyr);library(tidyr)")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to update all the library calls of modules on this package? I think in the past we changed this and then we had to revert it back.

Comment on lines 566 to 567
teal.code::eval_code(
c(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except here,

Can you break this into 2 eval_code?

Why? When concatennating "character" with "expression" (as here) it transforms it in an expression and the code that's run is a "string", not the actual contents.

I detected this while testing something else.

My suggestion:

      obj %>%
        teal.code::eval_code("library(ggplot2);library(dplyr)") %>% # nolint: quotes)
        teal.code::eval_code(
          c(
            as.expression(anl_merged_input()$expr)
          )
        )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted! I saw that the code generated was:

require(nestcolor)
CO2 <- data.frame(CO2)
stopifnot(rlang::hash(CO2) == "09a462eb86fab9a952e092bf6253c333") # @linksto CO2
.raw_data <- list2env(list(CO2 = CO2))
lockEnvironment(.raw_data) # @linksto .raw_data
"library(\"ggplot2\");library(\"dplyr\")"
ANL_1 <- CO2 %>% dplyr::select(conc, uptake, Type, Treatment)
ANL <- ANL_1

With this modification we get:

require(nestcolor)
CO2 <- data.frame(CO2)
stopifnot(rlang::hash(CO2) == "09a462eb86fab9a952e092bf6253c333") # @linksto CO2
.raw_data <- list2env(list(CO2 = CO2))
lockEnvironment(.raw_data) # @linksto .raw_data
library("ggplot2")
library("dplyr")
ANL_1 <- CO2 %>% dplyr::select(conc, uptake, Type, Treatment)
ANL <- ANL_1

#' argument in `teal.widgets::optionalSliderInputValMinMax`.
#'
# nolint start: line_length.
# nolint start: line_length
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, I don't think this is correct and the period is necessary

Note that on the first screenshot, I removed the period and changed the linter name and it passes.

On the second it fails

Image Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this puzzles me. But note that if you search for nolint on the package there are some that end with a dot and some that don't. I also tried to create a reprex and I couldn't ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: missing data module - another plot
2 participants