Skip to content

Commit a00f139

Browse files
authored
Merge branch 'main' into 1441_transformators@main
2 parents a4df140 + 67e9d92 commit a00f139

18 files changed

+137
-184
lines changed

.github/workflows/scheduled.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
strategy: ${{ matrix.test-strategy }}
3939
additional-env-vars: |
4040
PKG_SYSREQS_DRY_RUN=true
41+
extra-deps: |
42+
MultiAssayExperiment (>= 1.32.0);SummarizedExperiment (>= 1.36.0);teal.slice (>= 0.5.1.9021)
4143
branch-cleanup:
4244
if: >
4345
github.event_name == 'schedule' || (

DESCRIPTION

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Type: Package
22
Package: teal.modules.general
33
Title: General Modules for 'teal' Applications
4-
Version: 0.3.0.9063
5-
Date: 2025-01-15
4+
Version: 0.3.0.9064
5+
Date: 2025-01-17
66
Authors@R: c(
77
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
88
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
@@ -27,79 +27,79 @@ Depends:
2727
ggplot2 (>= 3.4.0),
2828
R (>= 3.6),
2929
shiny (>= 1.6.0),
30-
teal (>= 0.15.2.9091),
30+
teal (>= 0.15.2.9103),
3131
teal.transform (>= 0.5.0.9015)
3232
Imports:
3333
checkmate (>= 2.1.0),
34+
colourpicker (>= 1.3.0),
3435
dplyr (>= 1.0.5),
3536
DT (>= 0.13),
3637
forcats (>= 1.0.0),
38+
generics (>= 0.1.3),
39+
ggExtra (>= 0.10.1),
40+
ggpmisc (>= 0.4.3),
41+
ggpp (>= 0.5.8-1),
42+
ggrepel (>= 0.9.6),
43+
goftest (>= 1.2-3),
3744
grid,
45+
gridExtra (>= 2.3),
46+
htmlwidgets (>= 1.6.4),
47+
jsonlite (>= 1.8.9),
48+
lattice (>= 0.18-4),
49+
MASS (>= 7.3-61),
3850
rlistings (>= 0.2.8),
39-
scales,
40-
shinyjs,
51+
rtables (>= 0.6.8),
52+
scales (>= 1.3.0),
53+
shinyjs (>= 2.1.0),
4154
shinyTree (>= 0.2.8),
42-
shinyvalidate,
55+
shinyvalidate (>= 0.1.3),
4356
shinyWidgets (>= 0.5.1),
57+
sparkline (>= 2.0),
4458
stats,
4559
stringr (>= 1.4.1),
4660
teal.code (>= 0.5.0.9012),
4761
teal.data (>= 0.6.0.9015),
4862
teal.logger (>= 0.3.0.9003),
49-
teal.reporter (>= 0.3.0),
63+
teal.reporter (>= 0.3.1.9023),
5064
teal.widgets (>= 0.4.0),
5165
tern (>= 0.9.5),
5266
tibble (>= 2.0.0),
5367
tidyr (>= 0.8.3),
5468
tools,
5569
utils
5670
Suggests:
57-
broom (>= 0.7.10),
58-
colourpicker,
59-
ggExtra,
60-
ggpmisc (>= 0.4.3),
61-
ggpp,
62-
ggrepel,
63-
goftest,
64-
gridExtra,
65-
htmlwidgets,
66-
jsonlite,
6771
knitr (>= 1.42),
68-
lattice (>= 0.18-4),
6972
lifecycle (>= 0.2.0),
7073
logger (>= 0.2.0),
71-
MASS,
7274
nestcolor (>= 0.1.0),
7375
pkgload,
7476
rlang (>= 1.0.0),
7577
rmarkdown (>= 2.23),
7678
roxy.shinylive,
77-
rtables (>= 0.6.8),
7879
rvest,
7980
shinytest2,
80-
sparkline,
8181
testthat (>= 3.1.9),
8282
withr (>= 2.0.0)
8383
VignetteBuilder:
8484
knitr,
8585
rmarkdown
8686
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
8787
rstudio/shiny, insightsengineering/teal,
88-
insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr,
89-
rstudio/DT, tidyverse/forcats, r-lib/lifecycle, r-lib/scales,
90-
daattali/shinyjs, shinyTree/shinyTree, rstudio/shinyvalidate,
91-
dreamRs/shinyWidgets, tidyverse/stringr,
88+
insightsengineering/teal.slice, insightsengineering/teal.transform,
89+
mllg/checkmate, tidyverse/dplyr, rstudio/DT, tidyverse/forcats,
90+
r-lib/lifecycle, r-lib/scales, daattali/shinyjs, shinyTree/shinyTree,
91+
rstudio/shinyvalidate, dreamRs/shinyWidgets, tidyverse/stringr,
9292
insightsengineering/teal.code, insightsengineering/teal.data,
9393
insightsengineering/teal.logger, insightsengineering/teal.reporter,
9494
insightsengineering/teal.widgets, insightsengineering/tern,
95-
tidyverse/tibble, tidyverse/tidyr, tidymodels/broom,
96-
daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp,
97-
slowkow/ggrepel, baddstats/goftest, ramnathv/htmlwidgets,
98-
jeroen/jsonlite, yihui/knitr, daroczig/logger, deepayan/lattice,
99-
insightsengineering/nestcolor, r-lib/pkgload, r-lib/rlang,
100-
rstudio/rmarkdown, insightsengineering/roxy.shinylive,
101-
insightsengineering/rtables, tidyverse/rvest, htmlwidgets/sparkline,
102-
rstudio/shinytest2, r-lib/testthat, r-lib/withr
95+
tidyverse/tibble, tidyverse/tidyr, daattali/colourpicker,
96+
daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel,
97+
baddstats/goftest, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr,
98+
daroczig/logger, deepayan/lattice, insightsengineering/nestcolor,
99+
r-lib/pkgload, r-lib/rlang, rstudio/rmarkdown,
100+
insightsengineering/roxy.shinylive, insightsengineering/rtables,
101+
tidyverse/rvest, htmlwidgets/sparkline, rstudio/shinytest2,
102+
r-lib/testthat, r-lib/withr
103103
Config/Needs/website: insightsengineering/nesttemplate
104104
Encoding: UTF-8
105105
Language: en-US

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# teal.modules.general 0.3.0.9063
1+
# teal.modules.general 0.3.0.9064
22

33
* Removed `Show Warnings` modals from modules.
44

R/tm_g_distribution.R

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#' interactive <- function() TRUE
6161
#' {{ next_example }}
6262
# nolint start: line_length_linter.
63-
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)
63+
#' @examples
6464
# nolint end: line_length_linter.
6565
#' # general data example
6666
#' data <- teal_data()
@@ -88,7 +88,7 @@
8888
#' interactive <- function() TRUE
8989
#' {{ next_example }}
9090
# nolint start: line_length_linter.
91-
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggpp", quietly = TRUE) && require("goftest", quietly = TRUE) && require("MASS", quietly = TRUE) && require("broom", quietly = TRUE)
91+
#' @examples
9292
# nolint end: line_length_linter.
9393
#' # CDISC data example
9494
#' data <- teal_data()
@@ -154,16 +154,6 @@ tm_g_distribution <- function(label = "Distribution Module",
154154
decorators = NULL) {
155155
message("Initializing tm_g_distribution")
156156

157-
# Requires Suggested packages
158-
extra_packages <- c("ggpmisc", "ggpp", "goftest", "MASS", "broom")
159-
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
160-
if (length(missing_packages) > 0L) {
161-
stop(sprintf(
162-
"Cannot load package(s): %s.\nInstall or restart your session.",
163-
toString(missing_packages)
164-
))
165-
}
166-
167157
# Normalize the parameters
168158
if (inherits(dist_var, "data_extract_spec")) dist_var <- list(dist_var)
169159
if (inherits(strata_var, "data_extract_spec")) strata_var <- list(strata_var)
@@ -1229,7 +1219,7 @@ srv_distribution <- function(id,
12291219
expr = {
12301220
test_table_data <- ANL %>%
12311221
dplyr::select(dist_var) %>%
1232-
with(., broom::glance(do.call(test, args))) %>%
1222+
with(., generics::glance(do.call(test, args))) %>%
12331223
dplyr::mutate_if(is.numeric, round, 3)
12341224
},
12351225
env = env
@@ -1243,7 +1233,7 @@ srv_distribution <- function(id,
12431233
test_table_data <- ANL %>%
12441234
dplyr::select(dist_var, s_var, g_var) %>%
12451235
dplyr::group_by_at(dplyr::vars(dplyr::any_of(groups))) %>%
1246-
dplyr::do(tests = broom::glance(do.call(test, args))) %>%
1236+
dplyr::do(tests = generics::glance(do.call(test, args))) %>%
12471237
tidyr::unnest(tests) %>%
12481238
dplyr::mutate_if(is.numeric, round, 3)
12491239
},

R/tm_g_scatterplot.R

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#' interactive <- function() TRUE
4545
#' {{ next_example }}
4646
# nolint start: line_length_linter.
47-
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE)
47+
#' @examples
4848
# nolint end: line_length_linter.
4949
#' # general data example
5050
#' data <- teal_data()
@@ -133,7 +133,7 @@
133133
#' interactive <- function() TRUE
134134
#' {{ next_example }}
135135
# nolint start: line_length_linter.
136-
#' @examplesIf require("ggpmisc", quietly = TRUE) && require("ggExtra", quietly = TRUE) && require("colourpicker", quietly = TRUE)
136+
#' @examples
137137
# nolint end: line_length_linter.
138138
#' # CDISC data example
139139
#' data <- teal_data()
@@ -243,16 +243,6 @@ tm_g_scatterplot <- function(label = "Scatterplot",
243243
decorators = NULL) {
244244
message("Initializing tm_g_scatterplot")
245245

246-
# Requires Suggested packages
247-
extra_packages <- c("ggpmisc", "ggExtra", "colourpicker")
248-
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
249-
if (length(missing_packages) > 0L) {
250-
stop(sprintf(
251-
"Cannot load package(s): %s.\nInstall or restart your session.",
252-
toString(missing_packages)
253-
))
254-
}
255-
256246
# Normalize the parameters
257247
if (inherits(x, "data_extract_spec")) x <- list(x)
258248
if (inherits(y, "data_extract_spec")) y <- list(y)

R/tm_g_scatterplotmatrix.R

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#' library(teal.modules.general)
3131
#' interactive <- function() TRUE
3232
#' {{ next_example }}
33-
#' @examplesIf require("lattice", quietly = TRUE)
33+
#' @examples
3434
#' # general data example
3535
#' data <- teal_data()
3636
#' data <- within(data, {
@@ -117,7 +117,7 @@
117117
#' library(teal.modules.general)
118118
#' interactive <- function() TRUE
119119
#' {{ next_example }}
120-
#' @examplesIf require("lattice", quietly = TRUE)
120+
#' @examples
121121
#' # CDISC data example
122122
#' data <- teal_data()
123123
#' data <- within(data, {
@@ -181,11 +181,6 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
181181
decorators = NULL) {
182182
message("Initializing tm_g_scatterplotmatrix")
183183

184-
# Requires Suggested packages
185-
if (!requireNamespace("lattice", quietly = TRUE)) {
186-
stop("Cannot load lattice - please install the package or restart your session.")
187-
}
188-
189184
# Normalize the parameters
190185
if (inherits(variables, "data_extract_spec")) variables <- list(variables)
191186

R/tm_missing_data.R

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
#' library(teal.modules.general)
5151
#' interactive <- function() TRUE
5252
#' {{ next_example }}
53-
#' @examplesIf require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE)
53+
#' @examples
5454
#' # general example data
5555
#' data <- teal_data()
5656
#' data <- within(data, {
@@ -84,7 +84,7 @@
8484
#' library(teal.modules.general)
8585
#' interactive <- function() TRUE
8686
#' {{ next_example }}
87-
#' @examplesIf require("gridExtra", quietly = TRUE) && require("rlang", quietly = TRUE)
87+
#' @examples
8888
#' # CDISC example data
8989
#' data <- teal_data()
9090
#' data <- within(data, {
@@ -121,14 +121,6 @@ tm_missing_data <- function(label = "Missing data",
121121
decorators = NULL) {
122122
message("Initializing tm_missing_data")
123123

124-
# Requires Suggested packages
125-
if (!requireNamespace("gridExtra", quietly = TRUE)) {
126-
stop("Cannot load gridExtra - please install the package or restart your session.")
127-
}
128-
if (!requireNamespace("rlang", quietly = TRUE)) {
129-
stop("Cannot load rlang - please install the package or restart your session.")
130-
}
131-
132124
# Normalize the parameters
133125
if (inherits(ggplot2_args, "ggplot2_args")) ggplot2_args <- list(default = ggplot2_args)
134126

@@ -1175,6 +1167,13 @@ srv_missing_data <- function(id,
11751167
ggtheme = input$ggtheme
11761168
)
11771169

1170+
# Unlikely that `rlang` is not available, new hashing may be expensive
1171+
hashing_function <- if (requireNamespace("rlang", quietly = TRUE)) {
1172+
quote(rlang::hash)
1173+
} else {
1174+
function(x) paste(as.integer(x), collapse = "")
1175+
}
1176+
11781177
teal.code::eval_code(
11791178
common_code_q(),
11801179
substitute(
@@ -1189,41 +1188,44 @@ srv_missing_data <- function(id,
11891188
)
11901189
) %>%
11911190
teal.code::eval_code(
1192-
quote({
1193-
summary_plot_patients <- ANL[, c(parent_keys, analysis_vars)] %>%
1194-
dplyr::group_by_at(parent_keys) %>%
1195-
dplyr::mutate(id = dplyr::cur_group_id()) %>%
1196-
dplyr::ungroup() %>%
1197-
dplyr::group_by_at(c(parent_keys, "id")) %>%
1198-
dplyr::summarise_all(anyNA) %>%
1199-
dplyr::ungroup()
1200-
1201-
# order subjects by decreasing number of missing and then by
1202-
# missingness pattern (defined using sha1)
1203-
order_subjects <- summary_plot_patients %>%
1204-
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
1205-
dplyr::transmute(
1206-
id = dplyr::row_number(),
1207-
number_NA = apply(., 1, sum),
1208-
sha = apply(., 1, rlang::hash)
1209-
) %>%
1210-
dplyr::arrange(dplyr::desc(number_NA), sha) %>%
1211-
getElement(name = "id")
1212-
1213-
# order columns by decreasing percent of missing values
1214-
ordered_columns <- summary_plot_patients %>%
1215-
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
1216-
dplyr::summarise(
1217-
column = create_cols_labels(colnames(.)),
1218-
na_count = apply(., MARGIN = 2, FUN = sum),
1219-
na_percent = na_count / nrow(.) * 100
1220-
) %>%
1221-
dplyr::arrange(na_percent, dplyr::desc(column))
1222-
1223-
summary_plot_patients <- summary_plot_patients %>%
1224-
tidyr::gather("col", "isna", -"id", -dplyr::all_of(parent_keys)) %>%
1225-
dplyr::mutate(col = create_cols_labels(col))
1226-
})
1191+
substitute(
1192+
expr = {
1193+
summary_plot_patients <- ANL[, c(parent_keys, analysis_vars)] %>%
1194+
dplyr::group_by_at(parent_keys) %>%
1195+
dplyr::mutate(id = dplyr::cur_group_id()) %>%
1196+
dplyr::ungroup() %>%
1197+
dplyr::group_by_at(c(parent_keys, "id")) %>%
1198+
dplyr::summarise_all(anyNA) %>%
1199+
dplyr::ungroup()
1200+
1201+
# order subjects by decreasing number of missing and then by
1202+
# missingness pattern (defined using sha1)
1203+
order_subjects <- summary_plot_patients %>%
1204+
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
1205+
dplyr::transmute(
1206+
id = dplyr::row_number(),
1207+
number_NA = apply(., 1, sum),
1208+
sha = apply(., 1, hashing_function)
1209+
) %>%
1210+
dplyr::arrange(dplyr::desc(number_NA), sha) %>%
1211+
getElement(name = "id")
1212+
1213+
# order columns by decreasing percent of missing values
1214+
ordered_columns <- summary_plot_patients %>%
1215+
dplyr::select(-"id", -dplyr::all_of(parent_keys)) %>%
1216+
dplyr::summarise(
1217+
column = create_cols_labels(colnames(.)),
1218+
na_count = apply(., MARGIN = 2, FUN = sum),
1219+
na_percent = na_count / nrow(.) * 100
1220+
) %>%
1221+
dplyr::arrange(na_percent, dplyr::desc(column))
1222+
1223+
summary_plot_patients <- summary_plot_patients %>%
1224+
tidyr::gather("col", "isna", -"id", -dplyr::all_of(parent_keys)) %>%
1225+
dplyr::mutate(col = create_cols_labels(col))
1226+
},
1227+
env = list(hashing_function = hashing_function)
1228+
)
12271229
) %>%
12281230
teal.code::eval_code(
12291231
substitute(

0 commit comments

Comments
 (0)