|
1 | | -#' Outliers Module |
| 1 | +#' Outliers module |
2 | 2 | #' |
3 | 3 | #' Module to analyze and identify outliers using different methods |
| 4 | +#' such as IQR, Z-score, and Percentiles, and offers visualizations including |
| 5 | +#' box plots, density plots, and cumulative distribution plots to help interpret the outliers. |
4 | 6 | #' |
5 | 7 | #' @inheritParams teal::module |
6 | 8 | #' @inheritParams shared_params |
7 | 9 | #' |
8 | 10 | #' @param outlier_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) |
9 | | -#' variable to consider for the outliers analysis. |
10 | | -#' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) |
11 | | -#' categorical factor to split the selected outlier variables on. |
| 11 | +#' Specifies variable(s) to be analyzed for outliers. |
| 12 | +#' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`, optional) |
| 13 | +#' Specifies the categorical variable(s) to split the selected outlier variables on. |
12 | 14 | #' |
13 | 15 | #' @templateVar ggnames "Boxplot","Density Plot","Cumulative Distribution Plot" |
14 | 16 | #' @template ggplot2_args_multi |
15 | 17 | #' |
16 | 18 | #' @examples |
17 | | -#' # general data example |
18 | 19 | #' library(teal.widgets) |
19 | 20 | #' |
| 21 | +#' # general data example |
20 | 22 | #' data <- teal_data() |
21 | 23 | #' data <- within(data, { |
22 | 24 | #' CO2 <- CO2 |
|
67 | 69 | #' } |
68 | 70 | #' |
69 | 71 | #' # CDISC data example |
70 | | -#' library(teal.widgets) |
71 | | -#' |
72 | 72 | #' data <- teal_data() |
73 | 73 | #' data <- within(data, { |
74 | 74 | #' ADSL <- rADSL |
@@ -169,6 +169,7 @@ tm_outliers <- function(label = "Outliers Module", |
169 | 169 | ) |
170 | 170 | } |
171 | 171 |
|
| 172 | +# UI function for the outliers module |
172 | 173 | ui_outliers <- function(id, ...) { |
173 | 174 | args <- list(...) |
174 | 175 | ns <- NS(id) |
@@ -300,6 +301,7 @@ ui_outliers <- function(id, ...) { |
300 | 301 | ) |
301 | 302 | } |
302 | 303 |
|
| 304 | +# Server function for the outliers module |
303 | 305 | srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, |
304 | 306 | categorical_var, plot_height, plot_width, ggplot2_args) { |
305 | 307 | with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") |
|
0 commit comments