Skip to content

Commit 6767815

Browse files
authored
Merge pull request #110 from Merck/DEVR-3603-customize-ae-forestly
Ae Criterion updated
2 parents bfc7d9e + a9b2574 commit 6767815

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

R/ae_forestly.R

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#' @param filter A character value of the filter variable.
2424
#' @param filter_label A character value of the label for slider bar.
2525
#' @param filter_range A numeric vector of length 2 for the range of the slider bar.
26+
#' @param ae_label A character value of the label for criteria.
2627
#' If NULL (default), the range is automatically calculated from the data.
2728
#' If only one value is provided, it will be used as the maximum and minimum will be 0.
2829
#' @param width A numeric value of width of the table in pixels.
@@ -50,6 +51,7 @@ ae_forestly <- function(outdata,
5051
filter = c("prop", "n"),
5152
filter_label = NULL,
5253
filter_range = NULL,
54+
ae_label = NULL,
5355
width = 1400,
5456
max_page = NULL,
5557
dowload_button = FALSE) {
@@ -91,8 +93,8 @@ ae_forestly <- function(outdata,
9193

9294
if (is.null(filter_label)) {
9395
filter_label <- ifelse(filter == "prop",
94-
"Incidence (%) in One or More Treatment Groups",
95-
"Number of AE in One or More Treatment Groups"
96+
"Incidence (%) in One or More Treatment Groups",
97+
"Number of AE in One or More Treatment Groups"
9698
)
9799
}
98100

@@ -106,8 +108,8 @@ ae_forestly <- function(outdata,
106108

107109
parameters <- unlist(strsplit(outdata$parameter, ";"))
108110
par_label <- vapply(parameters,
109-
function(x) metalite::collect_adam_mapping(outdata$meta, x)$label,
110-
FUN.VALUE = character(1)
111+
function(x) metalite::collect_adam_mapping(outdata$meta, x)$label,
112+
FUN.VALUE = character(1)
111113
)
112114

113115
for (par in parameters[(!(parameters %in% unique(outdata$parameter_order)))]) {
@@ -138,9 +140,14 @@ ae_forestly <- function(outdata,
138140
default_param <- as.character(unique(outdata$tbl$parameter)[1])
139141

140142
random_id <- paste0("filter_ae_", uuid::UUIDgenerate(), "|", default_param)
143+
144+
if (is.null(ae_label)) {
145+
ae_label <- "AE Criteria"
146+
}
147+
141148
filter_ae <- crosstalk::filter_select(
142149
id = random_id,
143-
label = "AE Criteria",
150+
label = ae_label,
144151
sharedData = tbl,
145152
group = ~parameter,
146153
multiple = FALSE
@@ -195,9 +202,9 @@ ae_forestly <- function(outdata,
195202
t_details <- subset(
196203
outdata$ae_listing,
197204
((toupper(outdata$ae_listing$Adverse_Event) %in% toupper(t_row)) &
198-
(outdata$ae_listing$param == t_param)) |
205+
(outdata$ae_listing$param == t_param)) |
199206
((toupper(outdata$ae_listing$SOC_Name) %in% toupper(t_row)) &
200-
(outdata$ae_listing$param == t_param))
207+
(outdata$ae_listing$param == t_param))
201208
)
202209

203210
# Exclude 'param' column from t_details

man/ae_forestly.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)