Skip to content

Commit aa9d18c

Browse files
authored
Merge branch 'main' into 712-tm_a_pca@main
2 parents 7099007 + 9e5c0aa commit aa9d18c

9 files changed

+821
-172
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: teal.modules.general
33
Title: General Modules for 'teal' Applications
4-
Version: 0.3.0.9017
4+
Version: 0.3.0.9021
55
Date: 2024-04-19
66
Authors@R: c(
77
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),

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.9017
1+
# teal.modules.general 0.3.0.9021
22

33
# teal.modules.general 0.3.0
44

R/tm_g_bivariate.R

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -56,52 +56,49 @@
5656
#' CO2 <- data.frame(CO2)
5757
#' })
5858
#' datanames(data) <- c("CO2")
59-
#' join_keys(data) <- default_cdisc_join_keys[datanames(data)]
6059
#'
6160
#' app <- init(
6261
#' data = data,
63-
#' modules = modules(
64-
#' tm_g_bivariate(
65-
#' x = data_extract_spec(
66-
#' dataname = "CO2",
67-
#' select = select_spec(
68-
#' label = "Select variable:",
69-
#' choices = variable_choices(data[["CO2"]]),
70-
#' selected = "conc",
71-
#' fixed = FALSE
72-
#' )
73-
#' ),
74-
#' y = data_extract_spec(
75-
#' dataname = "CO2",
76-
#' select = select_spec(
77-
#' label = "Select variable:",
78-
#' choices = variable_choices(data[["CO2"]]),
79-
#' selected = "uptake",
80-
#' multiple = FALSE,
81-
#' fixed = FALSE
82-
#' )
83-
#' ),
84-
#' row_facet = data_extract_spec(
85-
#' dataname = "CO2",
86-
#' select = select_spec(
87-
#' label = "Select variable:",
88-
#' choices = variable_choices(data[["CO2"]]),
89-
#' selected = "Type",
90-
#' fixed = FALSE
91-
#' )
92-
#' ),
93-
#' col_facet = data_extract_spec(
94-
#' dataname = "CO2",
95-
#' select = select_spec(
96-
#' label = "Select variable:",
97-
#' choices = variable_choices(data[["CO2"]]),
98-
#' selected = "Treatment",
99-
#' fixed = FALSE
100-
#' )
101-
#' ),
102-
#' ggplot2_args = ggplot2_args(
103-
#' labs = list(subtitle = "Plot generated by Bivariate Module")
62+
#' modules = tm_g_bivariate(
63+
#' x = data_extract_spec(
64+
#' dataname = "CO2",
65+
#' select = select_spec(
66+
#' label = "Select variable:",
67+
#' choices = variable_choices(data[["CO2"]]),
68+
#' selected = "conc",
69+
#' fixed = FALSE
70+
#' )
71+
#' ),
72+
#' y = data_extract_spec(
73+
#' dataname = "CO2",
74+
#' select = select_spec(
75+
#' label = "Select variable:",
76+
#' choices = variable_choices(data[["CO2"]]),
77+
#' selected = "uptake",
78+
#' multiple = FALSE,
79+
#' fixed = FALSE
80+
#' )
81+
#' ),
82+
#' row_facet = data_extract_spec(
83+
#' dataname = "CO2",
84+
#' select = select_spec(
85+
#' label = "Select variable:",
86+
#' choices = variable_choices(data[["CO2"]]),
87+
#' selected = "Type",
88+
#' fixed = FALSE
89+
#' )
90+
#' ),
91+
#' col_facet = data_extract_spec(
92+
#' dataname = "CO2",
93+
#' select = select_spec(
94+
#' label = "Select variable:",
95+
#' choices = variable_choices(data[["CO2"]]),
96+
#' selected = "Treatment",
97+
#' fixed = FALSE
10498
#' )
99+
#' ),
100+
#' ggplot2_args = ggplot2_args(
101+
#' labs = list(subtitle = "Plot generated by Bivariate Module")
105102
#' )
106103
#' )
107104
#' )
@@ -121,48 +118,46 @@
121118
#'
122119
#' app <- init(
123120
#' data = data,
124-
#' modules = modules(
125-
#' tm_g_bivariate(
126-
#' x = data_extract_spec(
127-
#' dataname = "ADSL",
128-
#' select = select_spec(
129-
#' label = "Select variable:",
130-
#' choices = variable_choices(data[["ADSL"]]),
131-
#' selected = "AGE",
132-
#' fixed = FALSE
133-
#' )
134-
#' ),
135-
#' y = data_extract_spec(
136-
#' dataname = "ADSL",
137-
#' select = select_spec(
138-
#' label = "Select variable:",
139-
#' choices = variable_choices(data[["ADSL"]]),
140-
#' selected = "SEX",
141-
#' multiple = FALSE,
142-
#' fixed = FALSE
143-
#' )
144-
#' ),
145-
#' row_facet = data_extract_spec(
146-
#' dataname = "ADSL",
147-
#' select = select_spec(
148-
#' label = "Select variable:",
149-
#' choices = variable_choices(data[["ADSL"]]),
150-
#' selected = "ARM",
151-
#' fixed = FALSE
152-
#' )
153-
#' ),
154-
#' col_facet = data_extract_spec(
155-
#' dataname = "ADSL",
156-
#' select = select_spec(
157-
#' label = "Select variable:",
158-
#' choices = variable_choices(data[["ADSL"]]),
159-
#' selected = "COUNTRY",
160-
#' fixed = FALSE
161-
#' )
162-
#' ),
163-
#' ggplot2_args = ggplot2_args(
164-
#' labs = list(subtitle = "Plot generated by Bivariate Module")
121+
#' modules = tm_g_bivariate(
122+
#' x = data_extract_spec(
123+
#' dataname = "ADSL",
124+
#' select = select_spec(
125+
#' label = "Select variable:",
126+
#' choices = variable_choices(data[["ADSL"]]),
127+
#' selected = "AGE",
128+
#' fixed = FALSE
165129
#' )
130+
#' ),
131+
#' y = data_extract_spec(
132+
#' dataname = "ADSL",
133+
#' select = select_spec(
134+
#' label = "Select variable:",
135+
#' choices = variable_choices(data[["ADSL"]]),
136+
#' selected = "SEX",
137+
#' multiple = FALSE,
138+
#' fixed = FALSE
139+
#' )
140+
#' ),
141+
#' row_facet = data_extract_spec(
142+
#' dataname = "ADSL",
143+
#' select = select_spec(
144+
#' label = "Select variable:",
145+
#' choices = variable_choices(data[["ADSL"]]),
146+
#' selected = "ARM",
147+
#' fixed = FALSE
148+
#' )
149+
#' ),
150+
#' col_facet = data_extract_spec(
151+
#' dataname = "ADSL",
152+
#' select = select_spec(
153+
#' label = "Select variable:",
154+
#' choices = variable_choices(data[["ADSL"]]),
155+
#' selected = "COUNTRY",
156+
#' fixed = FALSE
157+
#' )
158+
#' ),
159+
#' ggplot2_args = ggplot2_args(
160+
#' labs = list(subtitle = "Plot generated by Bivariate Module")
166161
#' )
167162
#' )
168163
#' )
@@ -666,7 +661,12 @@ srv_g_bivariate <- function(id,
666661
expr = {
667662
# Add facetting labels
668663
# optional: grid.newpage() # nolint: commented_code.
669-
p <- add_facet_labels(p, xfacet_label = nulled_col_facet_name, yfacet_label = nulled_row_facet_name)
664+
# Prefixed with teal.modules.general as its usage will appear in "Show R code"
665+
p <- teal.modules.general::add_facet_labels(
666+
p,
667+
xfacet_label = nulled_col_facet_name,
668+
yfacet_label = nulled_row_facet_name
669+
)
670670
grid::grid.newpage()
671671
grid::grid.draw(p)
672672
},

R/tm_missing_data.R

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,11 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
730730
values = c("grey90", c(getOption("ggplot2.discrete.colour")[2], "#ff2951ff")[1]),
731731
labels = c("Present", "Missing")
732732
) +
733-
scale_y_continuous(labels = scales::percent_format(), breaks = seq(0, 1, by = 0.1), expand = c(0, 0)) +
733+
scale_y_continuous(
734+
labels = scales::percent_format(),
735+
breaks = seq(0, 1, by = 0.1),
736+
expand = c(0, 0)
737+
) +
734738
geom_text(
735739
aes(label = ifelse(isna == TRUE, sprintf("%d [%.02f%%]", n, n_pct), ""), y = 1),
736740
hjust = 1,
@@ -803,7 +807,11 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
803807
fill = ~isna
804808
) +
805809
geom_bar(alpha = 1, stat = "identity", position = "fill") +
806-
scale_y_continuous(labels = scales::percent_format(), breaks = seq(0, 1, by = 0.1), expand = c(0, 0)) +
810+
scale_y_continuous(
811+
labels = scales::percent_format(),
812+
breaks = seq(0, 1, by = 0.1),
813+
expand = c(0, 0)
814+
) +
807815
scale_fill_manual(
808816
name = "",
809817
values = c("grey90", c(getOption("ggplot2.discrete.colour")[2], "#ff2951ff")[1]),
@@ -972,7 +980,11 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
972980
dplyr::distinct() %>%
973981
ggplot(aes(x = id, y = n)) +
974982
geom_bar(stat = "identity", fill = c(getOption("ggplot2.discrete.colour")[2], "#ff2951ff")[1]) +
975-
geom_text(aes(label = n), position = position_dodge(width = 0.9), vjust = -0.25) +
983+
geom_text(
984+
aes(label = n),
985+
position = position_dodge(width = 0.9),
986+
vjust = -0.25
987+
) +
976988
ylim(c(0, max(data_combination_plot_cutoff$n) * 1.5)) +
977989
labs1 +
978990
ggthemes1 +

0 commit comments

Comments
 (0)