Skip to content

Commit

Permalink
unify decorators and transformators default values
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Jan 17, 2025
1 parent a00f139 commit 7e89058
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 115 deletions.
2 changes: 1 addition & 1 deletion R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ tm_a_pca <- function(label = "Principal Component Analysis",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_a_pca")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ tm_a_regression <- function(label = "Regression Analysis",
default_outlier_label = "USUBJID",
label_segment_threshold = c(0.5, 0, 10),
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_a_regression")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ tm_g_association <- function(label = "Association",
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_association")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_bivariate")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ tm_g_distribution <- function(label = "Distribution Module",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_distribution")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ tm_g_response <- function(label = "Response Plot",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_response")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ tm_g_scatterplot <- function(label = "Scatterplot",
table_dec = 4,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_scatterplot")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_g_scatterplotmatrix")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ tm_missing_data <- function(label = "Missing data",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_missing_data")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ tm_outliers <- function(label = "Outliers Module",
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_outliers")

# Normalize the parameters
Expand Down
2 changes: 1 addition & 1 deletion R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ tm_t_crosstable <- function(label = "Cross Table",
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = NULL) {
decorators = list()) {
message("Initializing tm_t_crosstable")

# Normalize the parameters
Expand Down
16 changes: 5 additions & 11 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#' - When the length of `size` is three: the plot points size are dynamically adjusted based on
#' vector of `value`, `min`, and `max`.
#' @param decorators `r lifecycle::badge("experimental")`
#' (`list` of `teal_transform_module`, named `list` of `teal_transform_module` or `NULL`) optional,
#' if not `NULL`, decorator for tables or plots included in the module.
#' (`list` of `teal_transform_module`, named `list` of `teal_transform_module`) optional,
#' decorator for tables or plots included in the module.
#' When a named list of `teal_transform_module`, the decorators are applied to the respective output objects.
#'
#' Otherwise, the decorators are applied to all objects, which is equivalent as using the name `default`.
Expand Down Expand Up @@ -342,14 +342,9 @@ ui_decorate_teal_data <- function(id, decorators, ...) {

#' Internal function to check if decorators is a valid object
#' @noRd
check_decorators <- function(x, names = NULL, null.ok = FALSE) { # nolint: object_name.
checkmate::qassert(null.ok, "B1")
check_decorators <- function(x, names = NULL) { # nolint: object_name.

check_message <- checkmate::check_list(
x,
null.ok = null.ok,
names = "named"
)
check_message <- checkmate::check_list(x, names = "named" )

Check warning on line 347 in R/utils.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/utils.R,line=347,col=60,[spaces_inside_linter] Do not place spaces before parentheses.

if (!is.null(names)) {
check_message <- if (isTRUE(check_message)) {
Expand All @@ -373,7 +368,6 @@ check_decorators <- function(x, names = NULL, null.ok = FALSE) { # nolint: objec
x,
checkmate::test_list,
types = "teal_transform_module",
null.ok = TRUE,
FUN.VALUE = logical(1L)
)

Expand Down Expand Up @@ -411,7 +405,7 @@ select_decorators <- function(decorators, scope) {
#' @return A named list of lists with `teal_transform_module` objects.
#' @keywords internal
normalize_decorators <- function(decorators) {
if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) {
if (checkmate::test_list(decorators, "teal_transform_module")) {
if (checkmate::test_names(names(decorators))) {
lapply(decorators, list)
} else {
Expand Down
4 changes: 2 additions & 2 deletions man/shared_params.Rd

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

14 changes: 7 additions & 7 deletions man/tm_a_pca.Rd

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

Loading

0 comments on commit 7e89058

Please sign in to comment.