Skip to content

Commit 25d872e

Browse files
authored
Merge branch 'main' into 821_select_datanames@main
2 parents 4f8e966 + 67e9d92 commit 25d872e

17 files changed

+128
-179
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: 28 additions & 32 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,75 @@ 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,
3845
lifecycle (>= 0.2.0),
3946
rlistings (>= 0.2.8),
40-
scales,
41-
shinyjs,
47+
rtables (>= 0.6.8),
48+
scales (>= 1.3.0),
49+
shinyjs (>= 2.1.0),
4250
shinyTree (>= 0.2.8),
43-
shinyvalidate,
51+
shinyvalidate (>= 0.1.3),
4452
shinyWidgets (>= 0.5.1),
53+
sparkline (>= 2.0),
4554
stats,
4655
stringr (>= 1.4.1),
4756
teal.code (>= 0.5.0.9012),
4857
teal.data (>= 0.6.0.9015),
4958
teal.logger (>= 0.3.0.9003),
50-
teal.reporter (>= 0.3.0),
59+
teal.reporter (>= 0.3.1.9023),
5160
teal.widgets (>= 0.4.0),
5261
tern (>= 0.9.5),
5362
tibble (>= 2.0.0),
5463
tidyr (>= 0.8.3),
5564
tools,
5665
utils
5766
Suggests:
58-
broom (>= 0.7.10),
59-
colourpicker,
60-
ggExtra,
61-
ggpmisc (>= 0.4.3),
62-
ggpp,
63-
ggrepel,
64-
goftest,
65-
gridExtra,
66-
htmlwidgets,
67-
jsonlite,
6867
knitr (>= 1.42),
6968
lattice (>= 0.18-4),
7069
logger (>= 0.2.0),
71-
MASS,
7270
nestcolor (>= 0.1.0),
7371
pkgload,
7472
rlang (>= 1.0.0),
7573
rmarkdown (>= 2.23),
7674
roxy.shinylive,
77-
rtables (>= 0.6.8),
7875
rvest,
7976
shinytest2,
80-
sparkline,
8177
testthat (>= 3.1.9),
8278
withr (>= 2.0.0)
8379
VignetteBuilder:
8480
knitr,
8581
rmarkdown
8682
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
8783
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,
84+
insightsengineering/teal.slice, insightsengineering/teal.transform,
85+
mllg/checkmate, tidyverse/dplyr, rstudio/DT, tidyverse/forcats,
86+
r-lib/lifecycle, r-lib/scales, daattali/shinyjs, shinyTree/shinyTree,
87+
rstudio/shinyvalidate, dreamRs/shinyWidgets, tidyverse/stringr,
9288
insightsengineering/teal.code, insightsengineering/teal.data,
9389
insightsengineering/teal.logger, insightsengineering/teal.reporter,
9490
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
91+
tidyverse/tibble, tidyverse/tidyr, daattali/colourpicker,
92+
daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel,
93+
baddstats/goftest, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr,
94+
daroczig/logger, deepayan/lattice, insightsengineering/nestcolor,
95+
r-lib/pkgload, r-lib/rlang, rstudio/rmarkdown,
96+
insightsengineering/roxy.shinylive, insightsengineering/rtables,
97+
tidyverse/rvest, htmlwidgets/sparkline, rstudio/shinytest2,
98+
r-lib/testthat, r-lib/withr
10399
Config/Needs/website: insightsengineering/nesttemplate
104100
Encoding: UTF-8
105101
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
* Soft deprecated `datasets_selected` argument of modules in favor of `datanames`.

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()
@@ -153,16 +153,6 @@ tm_g_distribution <- function(label = "Distribution Module",
153153
decorators = NULL) {
154154
message("Initializing tm_g_distribution")
155155

156-
# Requires Suggested packages
157-
extra_packages <- c("ggpmisc", "ggpp", "goftest", "MASS", "broom")
158-
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
159-
if (length(missing_packages) > 0L) {
160-
stop(sprintf(
161-
"Cannot load package(s): %s.\nInstall or restart your session.",
162-
toString(missing_packages)
163-
))
164-
}
165-
166156
# Normalize the parameters
167157
if (inherits(dist_var, "data_extract_spec")) dist_var <- list(dist_var)
168158
if (inherits(strata_var, "data_extract_spec")) strata_var <- list(strata_var)
@@ -1227,7 +1217,7 @@ srv_distribution <- function(id,
12271217
expr = {
12281218
test_table_data <- ANL %>%
12291219
dplyr::select(dist_var) %>%
1230-
with(., broom::glance(do.call(test, args))) %>%
1220+
with(., generics::glance(do.call(test, args))) %>%
12311221
dplyr::mutate_if(is.numeric, round, 3)
12321222
},
12331223
env = env
@@ -1241,7 +1231,7 @@ srv_distribution <- function(id,
12411231
test_table_data <- ANL %>%
12421232
dplyr::select(dist_var, s_var, g_var) %>%
12431233
dplyr::group_by_at(dplyr::vars(dplyr::any_of(groups))) %>%
1244-
dplyr::do(tests = broom::glance(do.call(test, args))) %>%
1234+
dplyr::do(tests = generics::glance(do.call(test, args))) %>%
12451235
tidyr::unnest(tests) %>%
12461236
dplyr::mutate_if(is.numeric, round, 3)
12471237
},

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()
@@ -242,16 +242,6 @@ tm_g_scatterplot <- function(label = "Scatterplot",
242242
decorators = NULL) {
243243
message("Initializing tm_g_scatterplot")
244244

245-
# Requires Suggested packages
246-
extra_packages <- c("ggpmisc", "ggExtra", "colourpicker")
247-
missing_packages <- Filter(function(x) !requireNamespace(x, quietly = TRUE), extra_packages)
248-
if (length(missing_packages) > 0L) {
249-
stop(sprintf(
250-
"Cannot load package(s): %s.\nInstall or restart your session.",
251-
toString(missing_packages)
252-
))
253-
}
254-
255245
# Normalize the parameters
256246
if (inherits(x, "data_extract_spec")) x <- list(x)
257247
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, {
@@ -180,11 +180,6 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
180180
decorators = NULL) {
181181
message("Initializing tm_g_scatterplotmatrix")
182182

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

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)