Skip to content

Commit 9cb9e85

Browse files
authored
Merge pull request #68 from Merck/61-can-users-custom-the-label-of-the-slide-bar
add argument to customize filter label
2 parents 217216d + 9b9ba70 commit 9cb9e85

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: forestly
22
Title: Interactive Forest Plot
3-
Version: 0.1.1
3+
Version: 0.1.2
44
Authors@R: c(
55
person("Yilong", "Zhang", role = c("aut")),
66
person("Benjamin", "Wang", email = "[email protected]", role = c("aut", "cre")),
@@ -47,4 +47,4 @@ Suggests:
4747
VignetteBuilder: knitr
4848
Config/testthat/edition: 3
4949
Roxygen: list(markdown = TRUE)
50-
RoxygenNote: 7.3.1
50+
RoxygenNote: 7.3.2

NEWS.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
# forestly 0.1.2
2+
3+
- Fix a bug that prevents reactable from rendering under reactR >= 0.6.0 (#67).
4+
- Add a new argument `filter_label` to `ae_forestly()` for controlling slider bar label (#68).
5+
16
# forestly 0.1.1
27

3-
- Add button to display SOC column for subset
4-
- Refine the default value of `meta_forestly()`
5-
- Update `format_ae_listing()` to be better aligned with oncology AEs reporting
6-
- Enhance functionality related to drill-down listing
7-
- Inherit paramter_term from all parameters of a metadata by default (#20)
8-
- Allow user to specify treatment group (#15)
9-
- Add warning when using tibble as input (#17)
8+
- Add button to display SOC column for subset.
9+
- Refine the default value of `meta_forestly()`.
10+
- Update `format_ae_listing()` to be better aligned with oncology AEs reporting.
11+
- Enhance functionality related to drill-down listing.
12+
- Inherit paramter_term from all parameters of a metadata by default (#20).
13+
- Allow user to specify treatment group (#15).
14+
- Add warning when using tibble as input (#17).
1015
- Fix bug when there is no record of a selected AE category (#9).
1116
- Fix bug when there are multiple plots displayed on one page (#12).
1217
- Update dataset `forestly_adae` since a variable was a factor

R/ae_forestly.R

+12-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#' @param outdata An `outdata` object created by [format_ae_forestly()].
2222
#' @param display_soc_toggle A boolean value to display SOC toggle button.
2323
#' @param filter A character value of the filter variable.
24+
#' @param filter_label A character value of the label for slider bar.
2425
#' @param width A numeric value of width of the table in pixels.
2526
#' @param max_page A numeric value of max page number shown in the table.
2627
#'
@@ -44,11 +45,18 @@
4445
ae_forestly <- function(outdata,
4546
display_soc_toggle = TRUE,
4647
filter = c("prop", "n"),
48+
filter_label = NULL,
4749
width = 1400,
4850
max_page = NULL) {
4951
filter <- match.arg(filter)
5052
filter_range <- c(0, 100)
5153

54+
if(is.null(filter_label)) {
55+
filter_label <- ifelse(filter == "prop",
56+
"Incidence (%) in One or More Treatment Groups",
57+
"Number of AE in One or More Treatment Groups")
58+
}
59+
5260
# `max_page` controls the maximum page number displayed in the interactive forest table.
5361
# By default (`NULL`), it will display the counts that round up to the nearest hundred.
5462
if (is.null(max_page)) {
@@ -102,7 +110,7 @@ ae_forestly <- function(outdata,
102110
if (filter == "prop") {
103111
filter_subject <- crosstalk::filter_slider(
104112
id = "filter_subject",
105-
label = "Incidence (%) in One or More Treatment Groups",
113+
label = filter_label,
106114
sharedData = tbl,
107115
column = ~hide_prop, # whose values will be used for this slider
108116
step = 1, # specifies interval between each select-able value on the slider
@@ -115,13 +123,13 @@ ae_forestly <- function(outdata,
115123
if (filter == "n") {
116124
filter_subject <- crosstalk::filter_slider(
117125
id = "filter_subject",
118-
label = "Number of AE in One or More Treatment Groups",
126+
label = filter_label,
119127
sharedData = tbl,
120128
column = ~hide_n,
121129
step = 1,
122130
width = 250,
123-
min = filter_range[1],
124-
max = filter_range[2]
131+
min = filter_range[1], # the leftmost value of the slider
132+
max = filter_range[2] # the rightmost value of the slider
125133
)
126134
}
127135

man/ae_forestly.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)