Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add argument to customize filter label #68

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: forestly
Title: Interactive Forest Plot
Version: 0.1.1
Version: 0.1.2
Authors@R: c(
person("Yilong", "Zhang", role = c("aut")),
person("Benjamin", "Wang", email = "[email protected]", role = c("aut", "cre")),
Expand Down Expand Up @@ -47,4 +47,4 @@ Suggests:
VignetteBuilder: knitr
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
19 changes: 12 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# forestly 0.1.2

- Fix a bug that prevents reactable from rendering under reactR >= 0.6.0 (#67).
- Add a new argument `filter_label` to `ae_forestly()` for controlling slider bar label (#68).

# forestly 0.1.1

- Add button to display SOC column for subset
- Refine the default value of `meta_forestly()`
- Update `format_ae_listing()` to be better aligned with oncology AEs reporting
- Enhance functionality related to drill-down listing
- Inherit paramter_term from all parameters of a metadata by default (#20)
- Allow user to specify treatment group (#15)
- Add warning when using tibble as input (#17)
- Add button to display SOC column for subset.
- Refine the default value of `meta_forestly()`.
- Update `format_ae_listing()` to be better aligned with oncology AEs reporting.
- Enhance functionality related to drill-down listing.
- Inherit paramter_term from all parameters of a metadata by default (#20).
- Allow user to specify treatment group (#15).
- Add warning when using tibble as input (#17).
- Fix bug when there is no record of a selected AE category (#9).
- Fix bug when there are multiple plots displayed on one page (#12).
- Update dataset `forestly_adae` since a variable was a factor
Expand Down
16 changes: 12 additions & 4 deletions R/ae_forestly.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#' @param outdata An `outdata` object created by [format_ae_forestly()].
#' @param display_soc_toggle A boolean value to display SOC toggle button.
#' @param filter A character value of the filter variable.
#' @param filter_label A character value of the label for slider bar.
#' @param width A numeric value of width of the table in pixels.
#' @param max_page A numeric value of max page number shown in the table.
#'
Expand All @@ -44,11 +45,18 @@
ae_forestly <- function(outdata,
display_soc_toggle = TRUE,
filter = c("prop", "n"),
filter_label = NULL,
width = 1400,
max_page = NULL) {
filter <- match.arg(filter)
filter_range <- c(0, 100)

if(is.null(filter_label)) {
filter_label <- ifelse(filter == "prop",
"Incidence (%) in One or More Treatment Groups",
"Number of AE in One or More Treatment Groups")
}

# `max_page` controls the maximum page number displayed in the interactive forest table.
# By default (`NULL`), it will display the counts that round up to the nearest hundred.
if (is.null(max_page)) {
Expand Down Expand Up @@ -102,7 +110,7 @@ ae_forestly <- function(outdata,
if (filter == "prop") {
filter_subject <- crosstalk::filter_slider(
id = "filter_subject",
label = "Incidence (%) in One or More Treatment Groups",
label = filter_label,
sharedData = tbl,
column = ~hide_prop, # whose values will be used for this slider
step = 1, # specifies interval between each select-able value on the slider
Expand All @@ -115,13 +123,13 @@ ae_forestly <- function(outdata,
if (filter == "n") {
filter_subject <- crosstalk::filter_slider(
id = "filter_subject",
label = "Number of AE in One or More Treatment Groups",
label = filter_label,
sharedData = tbl,
column = ~hide_n,
step = 1,
width = 250,
min = filter_range[1],
max = filter_range[2]
min = filter_range[1], # the leftmost value of the slider
max = filter_range[2] # the rightmost value of the slider
)
}

Expand Down
3 changes: 3 additions & 0 deletions man/ae_forestly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading