Skip to content

Commit

Permalink
unify decorators usage with outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Nov 18, 2024
1 parent 5196b7f commit f28d40d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 8 additions & 9 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#'
#' It takes the form of `c(value, min, max)` and it is passed to the `value_min_max`
#' argument in `teal.widgets::optionalSliderInputValMinMax`.
#' @param decorators (`list` of `teal_transform_module`)
#'
#' @templateVar ggnames `r regression_names`
#' @template ggplot2_args_multi
Expand Down Expand Up @@ -288,7 +287,7 @@ tm_a_regression <- function(label = "Regression Analysis",
}

# UI function for the regression module
ui_a_regression <- function(id, decorators, ...) {
ui_a_regression <- function(id, ...) {
ns <- NS(id)
args <- list(...)
is_single_dataset_value <- teal.transform::is_single_dataset(args$regressor, args$response)
Expand Down Expand Up @@ -325,37 +324,37 @@ ui_a_regression <- function(id, decorators, ...) {
conditionalPanel(
condition = "input.plot_type == 'Response vs Regressor'",
ns = ns,
ui_teal_transform_data(ns("d_0"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_0"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Residuals vs Fitted'",
ns = ns,
ui_teal_transform_data(ns("d_1"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_1"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Normal Q-Q'",
ns = ns,
ui_teal_transform_data(ns("d_2"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_2"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Scale-Location'",
ns = ns,
ui_teal_transform_data(ns("d_3"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_3"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Cook\\'s distance'",
ns = ns,
ui_teal_transform_data(ns("d_4"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_4"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Residuals vs Leverage'",
ns = ns,
ui_teal_transform_data(ns("d_5"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_5"), transformators = args$decorators[[1]])
),
conditionalPanel(
condition = "input.plot_type == 'Cook\\'s dist vs Leverage'",
ns = ns,
ui_teal_transform_data(ns("d_6"), transformators = decorators[[1]])
ui_teal_transform_data(ns("d_6"), transformators = args$decorators[[1]])
),
),
checkboxInput(ns("show_outlier"), label = "Display outlier labels", value = TRUE),
Expand Down
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#' with text placed before the output to put the output into context. For example a title.
#' @param post_output (`shiny.tag`) optional, text or UI element to be displayed after the module's output,
#' adding context or further instructions. Elements like `shiny::helpText()` are useful.
#' @param decorators (`list` of `teal_transform_module`) optional,
#' decorator for tables or plots included in the module.
#'
#' @param alpha (`integer(1)` or `integer(3)`) optional, specifies point opacity.
#' - When the length of `alpha` is one: the plot points will have a fixed opacity.
Expand Down

0 comments on commit f28d40d

Please sign in to comment.