diff --git a/R/teal.modules.general.R b/R/teal.modules.general.R index 0df71c52c..74c5d52c2 100644 --- a/R/teal.modules.general.R +++ b/R/teal.modules.general.R @@ -12,10 +12,9 @@ #' @importFrom magrittr %>% #' #' -#' @docType package #' @name teal.modules.general #' @keywords internal -NULL +"_PACKAGE" # nolint start # Note ggmosaic (version <= 0.3.3) needs to be in DEPENDS as the following does not work if it is imported diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 1606862a8..c1fda7608 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -61,7 +61,7 @@ tm_a_pca <- function(label = "Principal Component Analysis", dat, plot_height = c(600, 200, 2000), plot_width = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), rotate_xaxis_labels = FALSE, font_size = c(12, 8, 20), @@ -225,7 +225,7 @@ ui_a_pca <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ), @@ -343,9 +343,9 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl keep_cols <- as.character(merged$anl_input_r()$columns_source$dat) na_action <- input$na_action standardization <- input$standardization - center <- standardization %in% c("center", "center_scale") # nolint + center <- standardization %in% c("center", "center_scale") scale <- standardization == "center_scale" - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter teal::validate_has_data(ANL, 10) validate(need( @@ -374,9 +374,9 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl keep_cols <- as.character(merged$anl_input_r()$columns_source$dat) na_action <- input$na_action standardization <- input$standardization - center <- standardization %in% c("center", "center_scale") # nolint + center <- standardization %in% c("center", "center_scale") scale <- standardization == "center_scale" - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter qenv <- teal.code::eval_code( merged$anl_q_r(), @@ -389,7 +389,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl if (na_action == "drop") { qenv <- teal.code::eval_code( qenv, - quote(ANL <- tidyr::drop_na(ANL, keep_columns)) # nolint + quote(ANL <- tidyr::drop_na(ANL, keep_columns)) # nolint object_name_linter ) } @@ -461,8 +461,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl # plot elbow ---- plot_elbow <- function(base_q) { ggtheme <- input$ggtheme - rotate_xaxis_labels <- input$rotate_xaxis_labels # nolint - font_size <- input$font_size # nolint + rotate_xaxis_labels <- input$rotate_xaxis_labels + font_size <- input$font_size angle_value <- ifelse(isTRUE(rotate_xaxis_labels), 45, 0) hjust_value <- ifelse(isTRUE(rotate_xaxis_labels), 1, 0.5) @@ -536,13 +536,13 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl # plot circle ---- plot_circle <- function(base_q) { - x_axis <- input$x_axis # nolint - y_axis <- input$y_axis # nolint - variables <- input$variables # nolint + x_axis <- input$x_axis + y_axis <- input$y_axis + variables <- input$variables ggtheme <- input$ggtheme - rotate_xaxis_labels <- input$rotate_xaxis_labels # nolint - font_size <- input$font_size # nolint + rotate_xaxis_labels <- input$rotate_xaxis_labels + font_size <- input$font_size angle <- ifelse(isTRUE(rotate_xaxis_labels), 45, 0) hjust <- ifelse(isTRUE(rotate_xaxis_labels), 1, 0.5) @@ -611,21 +611,21 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl plot_biplot <- function(base_q) { qenv <- base_q - ANL <- qenv[["ANL"]] # nolint + ANL <- qenv[["ANL"]] # nolint object_name_linter resp_col <- as.character(merged$anl_input_r()$columns_source$response) dat_cols <- as.character(merged$anl_input_r()$columns_source$dat) - x_axis <- input$x_axis # nolint - y_axis <- input$y_axis # nolint - variables <- input$variables # nolint + x_axis <- input$x_axis + y_axis <- input$y_axis + variables <- input$variables pca <- qenv[["pca"]] ggtheme <- input$ggtheme - rotate_xaxis_labels <- input$rotate_xaxis_labels # nolint - alpha <- input$alpha # nolint - size <- input$size # nolint - font_size <- input$font_size # nolint + rotate_xaxis_labels <- input$rotate_xaxis_labels + alpha <- input$alpha + size <- input$size + font_size <- input$font_size qenv <- teal.code::eval_code( qenv, @@ -690,10 +690,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ) dev_labs <- list() } else { - rp_keys <- setdiff( - colnames(ANL), - as.character(unlist(merged$anl_input_r()$columns_source)) - ) # nolint + rp_keys <- setdiff(colnames(ANL), as.character(unlist(merged$anl_input_r()$columns_source))) response <- ANL[[resp_col]] @@ -710,7 +707,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl dev_labs <- list(color = varname_w_label(resp_col, ANL)) scales_biplot <- - if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint + if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint line_length_linter qenv <- teal.code::eval_code( qenv, quote(pca_rot$response <- as.factor(response)) @@ -825,11 +822,11 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl # plot pc_var ---- plot_pc_var <- function(base_q) { - pc <- input$pc # nolint + pc <- input$pc ggtheme <- input$ggtheme - rotate_xaxis_labels <- input$rotate_xaxis_labels # nolint - font_size <- input$font_size # nolint + rotate_xaxis_labels <- input$rotate_xaxis_labels + font_size <- input$font_size angle <- ifelse(rotate_xaxis_labels, 45, 0) hjust <- ifelse(rotate_xaxis_labels, 1, 0.5) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 34e25eee3..af146d997 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -84,10 +84,7 @@ tm_a_regression <- function(label = "Regression Analysis", plot_width = NULL, alpha = c(1, 0, 1), size = c(2, 1, 8), - ggtheme = c( - "gray", "bw", "linedraw", "light", "dark", - "minimal", "classic", "void", "test" - ), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL, @@ -217,7 +214,7 @@ ui_a_regression <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ) @@ -315,7 +312,7 @@ srv_a_regression <- function(id, # sets qenv object and populates it with data merge call and fit expression fit_r <- reactive({ - ANL <- anl_merged_q()[["ANL"]] # nolint + ANL <- anl_merged_q()[["ANL"]] # nolint object_name_linter teal::validate_has_data(ANL, 10) validate(need(is.numeric(ANL[regression_var()$response][[1]]), "Response variable should be numeric.")) @@ -402,9 +399,9 @@ srv_a_regression <- function(id, }) output_q <- reactive({ - alpha <- input$alpha # nolint - size <- input$size # nolint - ggtheme <- input$ggtheme # nolint + alpha <- input$alpha + size <- input$size + ggtheme <- input$ggtheme input_type <- input$plot_type show_outlier <- input$show_outlier @@ -412,7 +409,7 @@ srv_a_regression <- function(id, plot_type_0 <- function() { fit <- fit_r()[["fit"]] - ANL <- anl_merged_q()[["ANL"]] # nolint + ANL <- anl_merged_q()[["ANL"]] # nolint object_name_linter stopifnot(ncol(fit$model) == 2) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index ad20cc078..29adb0212 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -282,7 +282,7 @@ srv_data_table <- function(id, dt_args$options <- dt_options if (!is.null(input$dt_rows)) { - dt_args$options$pageLength <- input$dt_rows # nolint + dt_args$options$pageLength <- input$dt_rows } dt_args$data <- dataframe_selected diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 2a4bf5625..da605728b 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -9,12 +9,8 @@ #' associated variables. #' @param show_association optional, (`logical`) Whether show association of `vars` #' with reference variable. Defaults to `TRUE`. -#' @param distribution_theme optional, (`character`) `ggplot2` theme to be used by default. -#' One of `c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")`. -#' Each theme can be chosen by the user during the session. Defaults to `"gray"`. -#' @param association_theme optional, (`character`) `ggplot2` theme to be used by default. -#' One of `c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")`. -#' Each theme can be chosen by the user during the session. Defaults to `"gray"`. +#' @param distribution_theme,association_theme optional, (`character`) `ggplot2` themes to be used by default. +#' Default to `"gray"`. #' #' @templateVar ggnames "Bivariate1", "Bivariate2" #' @template ggplot2_args_multi @@ -78,14 +74,8 @@ tm_g_association <- function(label = "Association", show_association = TRUE, plot_height = c(600, 400, 5000), plot_width = NULL, - distribution_theme = c( - "gray", "bw", "linedraw", "light", "dark", - "minimal", "classic", "void", "test" - ), - association_theme = c( - "gray", "bw", "linedraw", "light", "dark", - "minimal", "classic", "void", "test" - ), + distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint line_length_linter + association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), # nolint line_length_linter pre_output = NULL, post_output = NULL, ggplot2_args = teal.widgets::ggplot2_args()) { @@ -188,14 +178,14 @@ ui_tm_g_association <- function(id, ...) { selectInput( inputId = ns("distribution_theme"), label = "Distribution theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$distribution_theme, multiple = FALSE ), selectInput( inputId = ns("association_theme"), label = "Association theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$association_theme, multiple = FALSE ) @@ -268,7 +258,7 @@ srv_tm_g_association <- function(id, output_q <- reactive({ teal::validate_inputs(iv_r()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter teal::validate_has_data(ANL, 3) vars_names <- merged$anl_input_r()$columns_source$vars @@ -286,7 +276,7 @@ srv_tm_g_association <- function(id, if (is_scatterplot) { shinyjs::show("alpha") shinyjs::show("size") - alpha <- input$alpha # nolint + alpha <- input$alpha size <- input$size } else { shinyjs::hide("alpha") diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 2ec66c397..39f95e05e 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -121,7 +121,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots", plot_width = NULL, rotate_xaxis_labels = FALSE, swap_axes = FALSE, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL) { @@ -338,7 +338,7 @@ ui_g_bivariate <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ), @@ -458,7 +458,7 @@ srv_g_bivariate <- function(id, output_q <- reactive({ teal::validate_inputs(iv_r()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter teal::validate_has_data(ANL, 3) x_col_vec <- as.vector(merged$anl_input_r()$columns_source$x) @@ -496,7 +496,7 @@ srv_g_bivariate <- function(id, if (is_scatterplot) { shinyjs::show("alpha") - alpha <- input$alpha # nolint + alpha <- input$alpha shinyjs::show("add_lines") if (color_settings && input$coloring) { @@ -585,7 +585,7 @@ srv_g_bivariate <- function(id, substitute( expr = { # Add facetting labels - # optional: grid.newpage() #nolintr + # optional: grid.newpage() # nolint commented_code_linter p <- add_facet_labels(p, xfacet_label = nulled_col_facet_name, yfacet_label = nulled_row_facet_name) grid::grid.newpage() grid::grid.draw(p) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 310b95cfd..d42cbf535 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -109,10 +109,7 @@ tm_g_distribution <- function(label = "Distribution Module", strata_var = NULL, group_var = NULL, freq = FALSE, - ggtheme = c( - "gray", "bw", "linedraw", "light", "dark", - "minimal", "classic", "void", "test" - ), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), bins = c(30L, 1L, 100L), plot_height = c(600, 200, 2000), @@ -303,7 +300,7 @@ ui_distribution <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ) @@ -496,7 +493,7 @@ srv_distribution <- function(id, ) } - ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] # nolint + ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] # nolint object_name_linter params <- get_dist_params(as.numeric(stats::na.omit(ANL[[dist_var2]])), input$t_dist) params_vec <- round(unname(unlist(params)), 2) params_names <- names(params) @@ -536,7 +533,7 @@ srv_distribution <- function(id, common_q <- reactive({ # Create a private stack for this function only. - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter dist_var <- merge_vars()$dist_var s_var <- merge_vars()$s_var g_var <- merge_vars()$g_var @@ -563,7 +560,7 @@ srv_distribution <- function(id, qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[g_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[g_var]]), "NA"), # nolint + expr = ANL[[g_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[g_var]]), "NA"), # nolint object_name_linter env = list(g_var = g_var) ) ) @@ -579,7 +576,7 @@ srv_distribution <- function(id, qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[s_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[s_var]]), "NA"), # nolint + expr = ANL[[s_var]] <- forcats::fct_na_value_to_level(as.factor(ANL[[s_var]]), "NA"), # nolint object_name_linter env = list(s_var = s_var) ) ) @@ -997,7 +994,7 @@ srv_distribution <- function(id, }, valueExpr = { # Create a private stack for this function only. - ANL <- common_q()[["ANL"]] # nolint + ANL <- common_q()[["ANL"]] # nolint object_name_linter dist_var <- merge_vars()$dist_var s_var <- merge_vars()$s_var diff --git a/R/tm_g_response.R b/R/tm_g_response.R index ce0c60a86..754433d3a 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -81,7 +81,7 @@ tm_g_response <- function(label = "Response Plot", freq = FALSE, plot_height = c(600, 400, 5000), plot_width = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL) { @@ -203,7 +203,7 @@ ui_g_response <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ) @@ -295,7 +295,7 @@ srv_g_response <- function(id, teal::validate_inputs(iv_r()) qenv <- merged$anl_q_r() - ANL <- qenv[["ANL"]] # nolint + ANL <- qenv[["ANL"]] # nolint object_name_linter resp_var <- as.vector(merged$anl_input_r()$columns_source$response) x <- as.vector(merged$anl_input_r()$columns_source$x) @@ -321,18 +321,18 @@ srv_g_response <- function(id, rotate_xaxis_labels <- input$rotate_xaxis_labels ggtheme <- input$ggtheme - arg_position <- if (freq) "stack" else "fill" # nolint + arg_position <- if (freq) "stack" else "fill" - rowf <- if (length(row_facet_name) == 0) NULL else as.name(row_facet_name) # nolint - colf <- if (length(col_facet_name) == 0) NULL else as.name(col_facet_name) # nolint - resp_cl <- as.name(resp_var) # nolint - x_cl <- as.name(x) # nolint + rowf <- if (length(row_facet_name) != 0) as.name(row_facet_name) + colf <- if (length(col_facet_name) != 0) as.name(col_facet_name) + resp_cl <- as.name(resp_var) + x_cl <- as.name(x) if (swap_axes) { qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[x]] <- with(ANL, forcats::fct_rev(x_cl)), # nolint + expr = ANL[[x]] <- with(ANL, forcats::fct_rev(x_cl)), # nolint object_name_linter env = list(x = x, x_cl = x_cl) ) ) @@ -341,7 +341,7 @@ srv_g_response <- function(id, qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]), # nolint + expr = ANL[[resp_var]] <- factor(ANL[[resp_var]]), # nolint object_name_linter env = list(resp_var = resp_var) ) ) %>% @@ -430,7 +430,7 @@ srv_g_response <- function(id, ) if (rotate_xaxis_labels) { - dev_ggplot2_args$theme[["axis.text.x"]] <- quote(element_text(angle = 45, hjust = 1)) # nolint + dev_ggplot2_args$theme[["axis.text.x"]] <- quote(element_text(angle = 45, hjust = 1)) } all_ggplot2_args <- teal.widgets::resolve_ggplot2_args( diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index cae83d74d..1cf20b3d8 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -152,10 +152,7 @@ tm_g_scatterplot <- function(label = "Scatterplot", size = c(5, 1, 15), max_deg = 5L, rotate_xaxis_labels = FALSE, - ggtheme = c( - "gray", "bw", "linedraw", "light", "dark", - "minimal", "classic", "void", "test" - ), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), pre_output = NULL, post_output = NULL, table_dec = 4, @@ -381,7 +378,7 @@ ui_g_scatterplot <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ) @@ -488,7 +485,7 @@ srv_g_scatterplot <- function(id, ) trend_line_is_applicable <- reactive({ - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter x_var <- as.vector(merged$anl_input_r()$columns_source$x) y_var <- as.vector(merged$anl_input_r()$columns_source$y) length(x_var) > 0 && length(y_var) > 0 && is.numeric(ANL[[x_var]]) && is.numeric(ANL[[y_var]]) @@ -515,7 +512,7 @@ srv_g_scatterplot <- function(id, output$num_na_removed <- renderUI({ if (add_trend_line()) { - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter x_var <- as.vector(merged$anl_input_r()$columns_source$x) y_var <- as.vector(merged$anl_input_r()$columns_source$y) if ((num_total_na <- nrow(ANL) - nrow(stats::na.omit(ANL[, c(x_var, y_var)]))) > 0) { @@ -539,7 +536,7 @@ srv_g_scatterplot <- function(id, output_q <- reactive({ teal::validate_inputs(iv_r(), iv_facet) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter x_var <- as.vector(merged$anl_input_r()$columns_source$x) y_var <- as.vector(merged$anl_input_r()$columns_source$y) @@ -555,16 +552,16 @@ srv_g_scatterplot <- function(id, } else { as.vector(merged$anl_input_r()$columns_source$col_facet) } - alpha <- input$alpha # nolint - size <- input$size # nolint - rotate_xaxis_labels <- input$rotate_xaxis_labels # nolint + alpha <- input$alpha + size <- input$size + rotate_xaxis_labels <- input$rotate_xaxis_labels add_density <- input$add_density ggtheme <- input$ggtheme rug_plot <- input$rug_plot - color <- input$color # nolint - shape <- `if`(is.null(input$shape) || identical(input$shape, ""), "circle", input$shape) # nolint + color <- input$color + shape <- `if`(is.null(input$shape) || identical(input$shape, ""), "circle", input$shape) smoothing_degree <- as.integer(input$smoothing_degree) - ci <- input$ci # nolint + ci <- input$ci log_x <- input$log_x log_y <- input$log_y @@ -640,7 +637,7 @@ srv_g_scatterplot <- function(id, plot_q <- teal.code::eval_code( object = plot_q, code = substitute( - expr = ANL[, log_x_var] <- log_x_fn(ANL[, x_var]), # nolint + expr = ANL[, log_x_var] <- log_x_fn(ANL[, x_var]), # nolint object_name_linter env = list( x_var = x_var, log_x_fn = as.name(log_x_fn), @@ -655,7 +652,7 @@ srv_g_scatterplot <- function(id, plot_q <- teal.code::eval_code( object = plot_q, code = substitute( - expr = ANL[, log_y_var] <- log_y_fn(ANL[, y_var]), # nolint + expr = ANL[, log_y_var] <- log_y_fn(ANL[, y_var]), # nolint object_name_linter env = list( y_var = y_var, log_y_fn = as.name(log_y_fn), @@ -788,7 +785,7 @@ srv_g_scatterplot <- function(id, plot_q <- teal.code::eval_code( plot_q, substitute( - expr = ANL <- dplyr::filter(ANL, !is.na(x_var) & !is.na(y_var)), # nolint + expr = ANL <- dplyr::filter(ANL, !is.na(x_var) & !is.na(y_var)), # nolint object_name_linter env = list(x_var = as.name(x_var), y_var = as.name(y_var)) ) ) @@ -850,7 +847,7 @@ srv_g_scatterplot <- function(id, ) if (rotate_xaxis_labels) { - dev_ggplot2_args$theme[["axis.text.x"]] <- quote(element_text(angle = 45, hjust = 1)) # nolint + dev_ggplot2_args$theme[["axis.text.x"]] <- quote(element_text(angle = 45, hjust = 1)) } all_ggplot2_args <- teal.widgets::resolve_ggplot2_args( diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index f7c26eddf..f4437161c 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -200,14 +200,14 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab teal::validate_inputs(iv_r()) qenv <- merged$anl_q_r() - ANL <- qenv[["ANL"]] # nolint + ANL <- qenv[["ANL"]] # nolint object_name_linter cols_names <- merged$anl_input_r()$columns_source$variables - alpha <- input$alpha # nolint - cex <- input$cex # nolint - add_cor <- input$cor # nolint - cor_method <- input$cor_method # nolint - cor_na_omit <- input$cor_na_omit # nolint + alpha <- input$alpha + cex <- input$cex + add_cor <- input$cor + cor_method <- input$cor_method + cor_na_omit <- input$cor_na_omit cor_na_action <- if (isTruthy(cor_na_omit)) { "na.omit" @@ -219,7 +219,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab teal::validate_has_data(ANL[, cols_names, drop = FALSE], 10, complete = TRUE, allow_inf = FALSE) # get labels and proper variable names - varnames <- varname_w_label(cols_names, ANL, wrap_width = 20) # nolint + varnames <- varname_w_label(cols_names, ANL, wrap_width = 20) # check character columns. If any, then those are converted to factors check_char <- vapply(ANL[, cols_names], is.character, logical(1)) @@ -227,7 +227,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL <- ANL[, cols_names] %>% # nolint + expr = ANL <- ANL[, cols_names] %>% # nolint object_name_linter dplyr::mutate_if(is.character, as.factor) %>% droplevels(), env = list(cols_names = cols_names) @@ -237,7 +237,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL <- ANL[, cols_names] %>% # nolint + expr = ANL <- ANL[, cols_names] %>% # nolint object_name_linter droplevels(), env = list(cols_names = cols_names) ) @@ -322,7 +322,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab output$message <- renderText({ shiny::req(iv_r()$is_valid()) req(selector_list()$variables()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter cols_names <- unique(unname(do.call(c, merged$anl_input_r()$columns_source))) check_char <- vapply(ANL[, cols_names], is.character, logical(1)) if (any(check_char)) { diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index c8b502da9..60a8f33f4 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -7,9 +7,7 @@ #' @inheritParams shared_params #' @param parent_dataname (`character(1)`) If this `dataname` exists in then "the by subject"graph is displayed. #' For `CDISC` data. In non `CDISC` data this can be ignored. Defaults to `"ADSL"`. -#' @param ggtheme optional, (`character`) `ggplot2` theme to be used by default. -#' One of `c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")`. -#' Each theme can be chosen by the user during the session. Defaults to `"classic"`. +#' @param ggtheme optional, (`character`) `ggplot2` theme to be used by default. Defaults to `"classic"`. #' #' @templateVar ggnames "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject" #' @template ggplot2_args_multi @@ -48,10 +46,7 @@ tm_missing_data <- function(label = "Missing data", plot_height = c(600, 400, 5000), plot_width = NULL, parent_dataname = "ADSL", - ggtheme = c( - "classic", "gray", "bw", "linedraw", - "light", "dark", "minimal", "void", "test" - ), + ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void"), ggplot2_args = list( "Combinations Hist" = teal.widgets::ggplot2_args(labs = list(caption = NULL)), "Combinations Main" = teal.widgets::ggplot2_args(labs = list(title = NULL)) @@ -353,7 +348,7 @@ encoding_missing_data <- function(id, summary_per_patient = FALSE, ggtheme, data selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = ggtheme, multiple = FALSE ) @@ -430,14 +425,14 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par teal.code::eval_code( data(), substitute( - expr = ANL <- anl_name[, selected_vars, drop = FALSE], # nolint + expr = ANL <- anl_name[, selected_vars, drop = FALSE], # nolint object_name_linter env = list(anl_name = as.name(dataname), selected_vars = selected_vars()) ) ) } else { teal.code::eval_code( data(), - substitute(expr = ANL <- anl_name, env = list(anl_name = as.name(dataname))) # nolint + substitute(expr = ANL <- anl_name, env = list(anl_name = as.name(dataname))) # nolint object_name_linter ) } @@ -445,13 +440,13 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[group_var]] <- anl_name[[group_var]], # nolint + expr = ANL[[group_var]] <- anl_name[[group_var]], # nolint object_name_linter env = list(group_var = group_var, anl_name = as.name(dataname)) ) ) } - new_col_name <- "**anyna**" # nolint variable assigned and used + new_col_name <- "**anyna**" qenv <- teal.code::eval_code( qenv, @@ -591,11 +586,11 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par qenv <- common_code_q() if (input$any_na) { - new_col_name <- "**anyna**" # nolint (local variable is assigned and used) + new_col_name <- "**anyna**" qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL[[new_col_name]] <- ifelse(rowSums(is.na(ANL)) > 0, NA, FALSE), # nolint + expr = ANL[[new_col_name]] <- ifelse(rowSums(is.na(ANL)) > 0, NA, FALSE), # nolint object_name_linter env = list(new_col_name = new_col_name) ) ) @@ -980,13 +975,13 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par ) ) - group_vals <- input$group_by_vals # nolint (local variable is assigned and used) + group_vals <- input$group_by_vals variables_select <- input$variables_select vars <- unique(variables_select, group_var) - count_type <- input$count_type # nolint (local variable is assigned and used) + count_type <- input$count_type if (!is.null(selected_vars()) && length(selected_vars()) != ncol(anl)) { - variables <- selected_vars() # nolint (local variable is assigned and used) + variables <- selected_vars() } else { variables <- colnames(anl) } diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 42b5976ef..40b3c728d 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -69,7 +69,7 @@ tm_outliers <- function(label = "Outliers Module", outlier_var, categorical_var = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), plot_height = c(600, 200, 2000), plot_width = NULL, @@ -231,7 +231,7 @@ ui_outliers <- function(id, ...) { selectInput( inputId = ns("ggtheme"), label = "Theme (by ggplot):", - choices = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test"), + choices = ggplot_themes, selected = args$ggtheme, multiple = FALSE ) @@ -311,7 +311,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, n_outlier_missing <- reactive({ shiny::req(iv_r()$is_valid()) outlier_var <- as.vector(merged$anl_input_r()$columns_source$outlier_var) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter sum(is.na(ANL[[outlier_var]])) }) @@ -321,12 +321,12 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, common_code_q <- reactive({ shiny::req(iv_r()$is_valid()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter qenv <- merged$anl_q_r() outlier_var <- as.vector(merged$anl_input_r()$columns_source$outlier_var) categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) - order_by_outlier <- input$order_by_outlier # nolint + order_by_outlier <- input$order_by_outlier method <- input$method split_outliers <- input$split_outliers teal::validate_has_data( @@ -350,7 +350,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL <- ANL %>% dplyr::filter(!is.na(outlier_var_name)), # nolint + expr = ANL <- ANL %>% dplyr::filter(!is.na(outlier_var_name)), # nolint object_name_linter env = list(outlier_var_name = as.name(outlier_var)) ) ) @@ -367,7 +367,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, qenv <- teal.code::eval_code( qenv, substitute( - expr = ANL <- ANL %>% dplyr::filter(!is.na(outlier_var_name)), # nolint + expr = ANL <- ANL %>% dplyr::filter(!is.na(outlier_var_name)), # nolint object_name_linter env = list(outlier_var_name = as.name(outlier_var)) ) ) @@ -376,7 +376,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, } # slider - outlier_definition_param <- if (method == "IQR") { # nolint + outlier_definition_param <- if (method == "IQR") { input$iqr_slider } else if (method == "Z-score") { input$zscore_slider @@ -399,7 +399,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, qenv, substitute( expr = { - ANL_OUTLIER <- ANL %>% # nolint + ANL_OUTLIER <- ANL %>% # nolint object_name_linter group_expr %>% # styler: off dplyr::mutate(is_outlier = { q1_q3 <- stats::quantile(outlier_var_name, probs = c(0.25, 0.75)) @@ -544,13 +544,13 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, # In order for geom_rug to work properly when reordering takes place inside facet_grid, # all tables must have the column used for reording. # In this case, the column used for reordering is `order`. - ANL_OUTLIER <- dplyr::left_join( # nolint + ANL_OUTLIER <- dplyr::left_join( # nolint object_name_linter ANL_OUTLIER, summary_table_pre[, c("order", categorical_var)], by = categorical_var ) # so that x axis of plot aligns with columns of summary table, from most outliers to least by percentage - ANL <- ANL %>% # nolint + ANL <- ANL %>% # nolint object_name_linter dplyr::left_join( dplyr::select(summary_table_pre, categorical_var_name, order), by = categorical_var @@ -602,11 +602,11 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, } ) - # boxplot/violinplot #nolint + # boxplot/violinplot # nolint commented_code_linter boxplot_q <- reactive({ req(common_code_q()) - ANL <- common_code_q()[["ANL"]] # nolint - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint + ANL <- common_code_q()[["ANL"]] # nolint object_name_linter + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter outlier_var <- as.vector(merged$anl_input_r()$columns_source$outlier_var) categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) @@ -615,7 +615,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal::validate_has_data(ANL, 1) # boxplot - plot_call <- quote(ANL %>% ggplot()) # nolint + plot_call <- quote(ANL %>% ggplot()) plot_call <- if (input$boxplot_alts == "Box plot") { substitute(expr = plot_call + geom_boxplot(outlier.shape = NA), env = list(plot_call = plot_call)) @@ -697,8 +697,8 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, # density plot density_plot_q <- reactive({ - ANL <- common_code_q()[["ANL"]] # nolint - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint + ANL <- common_code_q()[["ANL"]] # nolint object_name_linter + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter outlier_var <- as.vector(merged$anl_input_r()$columns_source$outlier_var) categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) @@ -757,8 +757,8 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, # Cumulative distribution plot cumulative_plot_q <- reactive({ - ANL <- common_code_q()[["ANL"]] # nolint - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint + ANL <- common_code_q()[["ANL"]] # nolint object_name_linter + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter qenv <- common_code_q() @@ -802,7 +802,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, all_categories <- lapply( unique(ANL[[categorical_var]]), function(x) { - ANL <- ANL %>% dplyr::filter(get(categorical_var) == x) # nolint + ANL <- ANL %>% dplyr::filter(get(categorical_var) == x) # nolint object_name_linter anl_outlier2 <- ANL_OUTLIER %>% dplyr::filter(get(categorical_var) == x) ecdf_df <- ANL %>% dplyr::mutate(y = stats::ecdf(ANL[[outlier_var]])(ANL[[outlier_var]])) @@ -979,7 +979,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, choices <- teal.transform::variable_choices(data()[[dataname_first]]) observeEvent(common_code_q(), { - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter teal.widgets::updateOptionalSelectInput( session, inputId = "table_ui_columns", @@ -995,9 +995,9 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, outlier_var <- as.vector(merged$anl_input_r()$columns_source$outlier_var) categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint - ANL_OUTLIER_EXTENDED <- common_code_q()[["ANL_OUTLIER_EXTENDED"]] # nolint - ANL <- common_code_q()[["ANL"]] # nolint + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter + ANL_OUTLIER_EXTENDED <- common_code_q()[["ANL_OUTLIER_EXTENDED"]] # nolint object_name_linter + ANL <- common_code_q()[["ANL"]] # nolint object_name_linter plot_brush <- if (tab == "Boxplot") { boxplot_r() box_pws$brush() @@ -1010,7 +1010,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, } # removing unused column ASAP - ANL_OUTLIER$order <- ANL$order <- NULL # nolint + ANL_OUTLIER$order <- ANL$order <- NULL # nolint object_name_linter display_table <- if (!is.null(plot_brush)) { if (length(categorical_var) > 0) { @@ -1026,7 +1026,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, if (tab == "Boxplot") { # in boxplot with no categorical variable, there is no column in ANL that would correspond to x-axis # so a column needs to be inserted with the value "Entire dataset" because that's the label used in plot - ANL[[plot_brush$mapping$x]] <- "Entire dataset" # nolint + ANL[[plot_brush$mapping$x]] <- "Entire dataset" # nolint object_name_linter } } @@ -1038,11 +1038,11 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, } else if (tab == "Cumulative Distribution Plot") { plot_brush$mapping$y <- "cdf" if (length(categorical_var) > 0) { - ANL <- ANL %>% # nolint + ANL <- ANL %>% # nolint object_name_linter dplyr::group_by(!!as.name(plot_brush$mapping$panelvar1)) %>% dplyr::mutate(cdf = stats::ecdf(!!as.name(outlier_var))(!!as.name(outlier_var))) } else { - ANL$cdf <- stats::ecdf(ANL[[outlier_var]])(ANL[[outlier_var]]) # nolint + ANL$cdf <- stats::ecdf(ANL[[outlier_var]])(ANL[[outlier_var]]) # nolint object_name_linter } } @@ -1087,10 +1087,10 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, output$total_outliers <- renderUI({ shiny::req(iv_r()$is_valid()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint - ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter + ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] # nolint object_name_linter teal::validate_has_data(ANL, 1) - ANL_OUTLIER_SELECTED <- ANL_OUTLIER[ANL_OUTLIER$is_outlier_selected, ] # nolint + ANL_OUTLIER_SELECTED <- ANL_OUTLIER[ANL_OUTLIER$is_outlier_selected, ] # nolint object_name_linter h5( sprintf( "%s %d / %d [%.02f%%]", @@ -1104,7 +1104,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, output$total_missing <- renderUI({ if (n_outlier_missing() > 0) { - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter helpText( sprintf( "%s %d / %d [%.02f%%]", diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 49ba6afd2..4aecdb030 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -233,7 +233,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, output_q <- reactive({ teal::validate_inputs(iv_r()) - ANL <- merged$anl_q_r()[["ANL"]] # nolint + ANL <- merged$anl_q_r()[["ANL"]] # nolint object_name_linter # As this is a summary x_name <- as.vector(merged$anl_input_r()$columns_source$x) @@ -252,8 +252,8 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, "Selected column variable has an unsupported data type." )) - show_percentage <- input$show_percentage # nolint - show_total <- input$show_total # nolint + show_percentage <- input$show_percentage + show_total <- input$show_total plot_title <- paste( "Cross-Table of", @@ -317,7 +317,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, teal.code::eval_code( substitute( expr = { - ANL <- tern::df_explicit_na(ANL) # nolint + ANL <- tern::df_explicit_na(ANL) # nolint object_name_linter tbl <- rtables::build_table(lyt = lyt, df = ANL[order(ANL[[y_name]]), ]) tbl }, diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 901d3ca18..a68ff2a0e 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -139,10 +139,7 @@ ui_variable_browser <- function(id, collapsed = TRUE, selectInput( inputId = ns("ggplot_theme"), label = "ggplot2 theme", - choices = c( - "gray", "bw", "linedraw", "light", - "dark", "minimal", "classic", "void", "test" - ), + choices = ggplot_themes, selected = "grey" ), fluidRow( @@ -184,7 +181,7 @@ srv_variable_browser <- function(id, .unique_records_for_factor <- 30 # if there are < this number of unique records then a numeric # variable is by default treated as a factor - .unique_records_default_as_factor <- 6 # nolint + .unique_records_default_as_factor <- 6 # nolint object_length_linter datanames <- isolate(teal.data::datanames(data())) datanames <- Filter(function(name) { @@ -234,7 +231,7 @@ srv_variable_browser <- function(id, condition = length(parent_dataname) > 0 && parent_dataname %in% datanames ) - columns_names <- new.env() # nolint + columns_names <- new.env() # plot_var$data holds the name of the currently selected dataset # plot_var$variable[[]] holds the name of the currently selected @@ -550,7 +547,7 @@ create_sparklines <- function(arr, width = 150, ...) { #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.default <- function(arr, width = 150, ...) { # nolint +create_sparklines.default <- function(arr, width = 150, ...) { return(as.character(tags$code("unsupported variable type", class = "text-blue"))) } @@ -564,7 +561,7 @@ create_sparklines.default <- function(arr, width = 150, ...) { # nolint #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.Date <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { # nolint +create_sparklines.Date <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { arr_num <- as.numeric(arr) arr_num <- sort(arr_num, decreasing = FALSE, method = "radix") binwidth <- get_bin_width(arr_num, 1) @@ -604,7 +601,7 @@ create_sparklines.Date <- function(arr, width = 150, bar_spacing = 5, bar_width #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.POSIXct <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { # nolint +create_sparklines.POSIXct <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { arr_num <- as.numeric(arr) arr_num <- sort(arr_num, decreasing = FALSE, method = "radix") binwidth <- get_bin_width(arr_num, 1) @@ -644,7 +641,7 @@ create_sparklines.POSIXct <- function(arr, width = 150, bar_spacing = 5, bar_wid #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.POSIXlt <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { # nolint +create_sparklines.POSIXlt <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { arr_num <- as.numeric(arr) arr_num <- sort(arr_num, decreasing = FALSE, method = "radix") binwidth <- get_bin_width(arr_num, 1) @@ -684,7 +681,7 @@ create_sparklines.POSIXlt <- function(arr, width = 150, bar_spacing = 5, bar_wid #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.character <- function(arr, ...) { # nolint +create_sparklines.character <- function(arr, ...) { return(create_sparklines(as.factor(arr))) } @@ -699,7 +696,7 @@ create_sparklines.character <- function(arr, ...) { # nolint #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.logical <- function(arr, ...) { # nolint +create_sparklines.logical <- function(arr, ...) { return(create_sparklines(as.factor(arr))) } @@ -714,7 +711,7 @@ create_sparklines.logical <- function(arr, ...) { # nolint #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.factor <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { # nolint +create_sparklines.factor <- function(arr, width = 150, bar_spacing = 5, bar_width = 20, ...) { decreasing_order <- TRUE counts <- table(arr) @@ -754,7 +751,7 @@ create_sparklines.factor <- function(arr, width = 150, bar_spacing = 5, bar_widt #' @export #' @keywords internal #' @rdname create_sparklines -create_sparklines.numeric <- function(arr, width = 150, ...) { # nolint +create_sparklines.numeric <- function(arr, width = 150, ...) { if (any(is.infinite(arr))) { return(as.character(tags$code("infinite values", class = "text-blue"))) } @@ -882,7 +879,7 @@ plot_var_summary <- function(var, wrap_character = NULL, numeric_as_factor, display_density = is.numeric(var), - remove_NA_hist = FALSE, # nolint + remove_NA_hist = FALSE, # nolint object_name_linter outlier_definition, records_for_factor, ggplot2_args) { diff --git a/R/utils.R b/R/utils.R index 07db56a98..1d2a1e56d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -9,9 +9,7 @@ #' for a slider encoding the plot width. #' @param rotate_xaxis_labels optional, (`logical`) Whether to rotate plot X axis labels. Does not #' rotate by default (`FALSE`). -#' @param ggtheme optional, (`character`) `ggplot2` theme to be used by default. -#' One of `c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")`. -#' Each theme can be chosen by the user during the session. Defaults to `"gray"`. +#' @param ggtheme optional, (`character`) `ggplot2` theme to be used by default. Defaults to `"gray"`. #' @param ggplot2_args (`ggplot2_args`) object created by [teal.widgets::ggplot2_args()] #' with settings for the module plot. #' The argument is merged with options variable `teal.ggplot2_args` and default module setup. diff --git a/R/zzz.R b/R/zzz.R index c99f35e18..f9db273c7 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,3 +1,5 @@ -.onLoad <- function(libname, pkgname) { # nolint +.onLoad <- function(libname, pkgname) { teal.logger::register_logger(namespace = "teal.modules.general") } + +ggplot_themes <- c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void") diff --git a/data-raw/data.R b/data-raw/data.R index 3d0abb238..ab21d2721 100644 --- a/data-raw/data.R +++ b/data-raw/data.R @@ -1,16 +1,16 @@ ## code to prepare `data` for testing examples library(scda) -rADAE <- synthetic_cdisc_data("latest")$adae # nolint +rADAE <- synthetic_cdisc_data("latest")$adae # nolint object_name_linter usethis::use_data(rADAE) -rADLB <- synthetic_cdisc_data("latest")$adlb # nolint +rADLB <- synthetic_cdisc_data("latest")$adlb # nolint object_name_linter usethis::use_data(rADLB) -rADRS <- synthetic_cdisc_data("latest")$adrs # nolint +rADRS <- synthetic_cdisc_data("latest")$adrs # nolint object_name_linter usethis::use_data(rADRS) -rADSL <- synthetic_cdisc_data("latest")$adsl # nolint +rADSL <- synthetic_cdisc_data("latest")$adsl # nolint object_name_linter usethis::use_data(rADSL) -rADTTE <- synthetic_cdisc_data("latest")$adtte # nolint +rADTTE <- synthetic_cdisc_data("latest")$adtte # nolint object_name_linter usethis::use_data(rADTTE) diff --git a/man/shared_params.Rd b/man/shared_params.Rd index b80f052b5..f7fb3ffac 100644 --- a/man/shared_params.Rd +++ b/man/shared_params.Rd @@ -13,9 +13,7 @@ for a slider encoding the plot width.} \item{rotate_xaxis_labels}{optional, (\code{logical}) Whether to rotate plot X axis labels. Does not rotate by default (\code{FALSE}).} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{(\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for the module plot. diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index bf8eadfd8..e01bdbe27 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -9,8 +9,7 @@ tm_a_pca( dat, plot_height = c(600, 200, 2000), plot_width = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), rotate_xaxis_labels = FALSE, font_size = c(12, 8, 20), @@ -33,9 +32,7 @@ for a slider encoding the plot height.} \item{plot_width}{optional, (\code{numeric}) A vector of length three with \verb{c(value, min and max)} for a slider encoding the plot width.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{optional, (\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index d4700b3cb..a52ea262c 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -12,8 +12,7 @@ tm_a_regression( plot_width = NULL, alpha = c(1, 0, 1), size = c(2, 1, 8), - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL, @@ -45,9 +44,7 @@ length three with \code{c(value, min, max)}.} If a slider should be presented to adjust the plot point sizes dynamically then it can be a vector of length three with \code{c(value, min, max)}.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{optional, (\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index a765bd2ef..321d1d175 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -12,9 +12,9 @@ tm_g_association( plot_height = c(600, 400, 5000), plot_width = NULL, distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", - "void", "test"), + "void"), association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", - "void", "test"), + "void"), pre_output = NULL, post_output = NULL, ggplot2_args = teal.widgets::ggplot2_args() @@ -39,13 +39,8 @@ for a slider encoding the plot height.} \item{plot_width}{optional, (\code{numeric}) A vector of length three with \verb{c(value, min and max)} for a slider encoding the plot width.} -\item{distribution_theme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} - -\item{association_theme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{distribution_theme, association_theme}{optional, (\code{character}) \code{ggplot2} themes to be used by default. +Default to \code{"gray"}.} \item{pre_output}{(\code{shiny.tag}, optional)\cr with text placed before the output to put the output into context. For example a title.} diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index 430b6894a..12a90c52f 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -22,8 +22,7 @@ tm_g_bivariate( plot_width = NULL, rotate_xaxis_labels = FALSE, swap_axes = FALSE, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL @@ -85,9 +84,7 @@ rotate by default (\code{FALSE}).} \item{swap_axes}{optional, (\code{logical}) Whether to swap X and Y axes. Defaults to \code{FALSE}.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{(\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for the module plot. diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 6be2badf0..a82403274 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -10,8 +10,7 @@ tm_g_distribution( strata_var = NULL, group_var = NULL, freq = FALSE, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), bins = c(30L, 1L, 100L), plot_height = c(600, 200, 2000), @@ -36,9 +35,7 @@ Which data columns to use for faceting rows.} \item{freq}{optional, (\code{logical}) Whether to display frequency (\code{TRUE}) or density (\code{FALSE}). Defaults to density (\code{FALSE}).} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{optional, (\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index 9df112bda..6d0986c2f 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -16,8 +16,7 @@ tm_g_response( freq = FALSE, plot_height = c(600, 400, 5000), plot_width = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), pre_output = NULL, post_output = NULL @@ -60,9 +59,7 @@ for a slider encoding the plot height.} \item{plot_width}{optional, (\code{numeric}) A vector of length three with \verb{c(value, min and max)} for a slider encoding the plot width.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{(\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for the module plot. diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index ecd33de66..1c742cac2 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -19,8 +19,7 @@ tm_g_scatterplot( size = c(5, 1, 15), max_deg = 5L, rotate_xaxis_labels = FALSE, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), pre_output = NULL, post_output = NULL, table_dec = 4, @@ -72,9 +71,7 @@ vector of length three with \code{c(value, min, max)}.} \item{rotate_xaxis_labels}{optional, (\code{logical}) Whether to rotate plot X axis labels. Does not rotate by default (\code{FALSE}).} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{pre_output}{(\code{shiny.tag}, optional)\cr with text placed before the output to put the output into context. For example a title.} diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index 73438aa4f..c8cc46e2e 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -9,8 +9,7 @@ tm_missing_data( plot_height = c(600, 400, 5000), plot_width = NULL, parent_dataname = "ADSL", - ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void", - "test"), + ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void"), ggplot2_args = list(`Combinations Hist` = teal.widgets::ggplot2_args(labs = list(caption = NULL)), `Combinations Main` = teal.widgets::ggplot2_args(labs = list(title = NULL))), @@ -31,9 +30,7 @@ for a slider encoding the plot width.} \item{parent_dataname}{(\code{character(1)}) If this \code{dataname} exists in then "the by subject"graph is displayed. For \code{CDISC} data. In non \code{CDISC} data this can be ignored. Defaults to \code{"ADSL"}.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"classic"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"classic"}.} \item{ggplot2_args}{optional, (\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index dd262f2ab..8c140e81d 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -8,8 +8,7 @@ tm_outliers( label = "Outliers Module", outlier_var, categorical_var = NULL, - ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", - "test"), + ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"), ggplot2_args = teal.widgets::ggplot2_args(), plot_height = c(600, 200, 2000), plot_width = NULL, @@ -27,9 +26,7 @@ variable to consider for the outliers analysis.} \item{categorical_var}{(\code{data_extract_spec} or \code{list} of multiple \code{data_extract_spec}) categorical factor to split the selected outlier variables on.} -\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. -One of \code{c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")}. -Each theme can be chosen by the user during the session. Defaults to \code{"gray"}.} +\item{ggtheme}{optional, (\code{character}) \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} \item{ggplot2_args}{optional, (\code{ggplot2_args}) object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings.