Skip to content
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
56 changes: 32 additions & 24 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@
#' )
#' )
#' ),
#' categorical_var = data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
#' vars = vars,
#' choices = value_choices(ADSL, vars$selected),
#' selected = value_choices(ADSL, vars$selected),
#' multiple = TRUE
#' categorical_var = list(
#' data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
#' vars = vars,
#' choices = value_choices(ADSL, vars$selected),
#' selected = value_choices(ADSL, vars$selected),
#' multiple = TRUE
#' )
#' )
#' ),
#' ggplot2_args = teal.widgets::ggplot2_args(
#' labs = list(subtitle = "Plot generated by Outliers Module")
#' ggplot2_args = list(
#' teal.widgets::ggplot2_args(
#' labs = list(subtitle = "Plot generated by Outliers Module")
#' )
#' )
#' )
#' )
Expand Down Expand Up @@ -125,13 +129,16 @@ ui_outliers <- function(id, ...) {
id = ns("tabs"),
tabPanel(
"Boxplot",
teal.widgets::plot_with_settings_ui(id = ns("box_plot"))),
teal.widgets::plot_with_settings_ui(id = ns("box_plot"))
),
tabPanel(
"Density Plot",
teal.widgets::plot_with_settings_ui(id = ns("density_plot"))),
teal.widgets::plot_with_settings_ui(id = ns("density_plot"))
),
tabPanel(
"Cumulative Distribution Plot",
teal.widgets::plot_with_settings_ui(id = ns("cum_density_plot")))
teal.widgets::plot_with_settings_ui(id = ns("cum_density_plot"))
)
),
br(), hr(),
uiOutput(ns("table_ui_wrap"))
Expand Down Expand Up @@ -248,10 +255,11 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,

rule_diff <- function(other) {
function(value) {
othervalue <- selector_list()[[other]]()[["select"]]
othervalue <- tryCatch(selector_list()[["categorical_var"]]()[["select"]], error = function(e) NULL)
if (!is.null(othervalue)) {
if (identical(othervalue, value))
if (identical(othervalue, value)) {
"`Variable` and `Categorical factor` cannot be the same"
}
}
}
}
Expand Down Expand Up @@ -409,7 +417,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
q1_q3 <- stats::quantile(outlier_var_name, probs = c(0.25, 0.75))
iqr <- q1_q3[2] - q1_q3[1]
!(outlier_var_name >= q1_q3[1] - outlier_definition_param * iqr &
outlier_var_name <= q1_q3[2] + outlier_definition_param * iqr)
outlier_var_name <= q1_q3[2] + outlier_definition_param * iqr)
}),
env = list(
outlier_var_name = as.name(outlier_var),
Expand Down Expand Up @@ -558,16 +566,16 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
expr = {
if (iv_r()$is_valid()) {
categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var)
DT::datatable(
common_code_q()[["summary_table"]],
options = list(
dom = "t",
autoWidth = TRUE,
columnDefs = list(list(width = "200px", targets = "_all"))
if (!is.null(categorical_var)) {
DT::datatable(
common_code_q()[["summary_table"]],
options = list(
dom = "t",
autoWidth = TRUE,
columnDefs = list(list(width = "200px", targets = "_all"))
)
)
)
} else {
NULL
}
}
}
)
Expand Down
22 changes: 13 additions & 9 deletions man/tm_outliers.Rd

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