diff --git a/.lintr b/.lintr index 34473d273..0a0bb22f3 100644 --- a/.lintr +++ b/.lintr @@ -1,5 +1,6 @@ linters: linters_with_defaults( line_length_linter = line_length_linter(120), cyclocomp_linter = NULL, - object_usage_linter = NULL + object_usage_linter = NULL, + indentation_linter = NULL ) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index e5bbc62d0..cc4f5ebd8 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -999,12 +999,13 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("PCA Plot") - card$append_text("PCA Plot", "header2") - card$append_text("Principal Component Analysis Plot", "header3") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Principal Component Analysis Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Principal Components Table", "header3") card$append_table(computation()[["tbl_importance"]]) card$append_text("Eigenvectors Table", "header3") diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index e7f3650d8..8ddaaf523 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -869,11 +869,13 @@ srv_a_regression <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Linear Regression Plot") - card$append_text("Linear Regression Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Linear Regression Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_association.R b/R/tm_g_association.R index ca524a1e6..36ee84d82 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -458,11 +458,13 @@ srv_tm_g_association <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Association Plot") - card$append_text("Association Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Association Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 464f6e19f..2acd0b487 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -620,11 +620,13 @@ srv_g_bivariate <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Bivariate Plot") - card$append_text("Bivariate Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Bivariate Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 9fa6eaaad..9a055e955 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -1225,11 +1225,13 @@ srv_distribution <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Distribution Plot") - card$append_text("Distribution Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Distribution Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") if (input$tabs == "Histogram") { card$append_plot(dist_r(), dim = pws1$dim()) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 483a6a1c3..57e1a9856 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -476,11 +476,13 @@ srv_g_response <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Response Plot") - card$append_text("Response Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Response Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index f7aea4ff2..d728d4628 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -948,11 +948,13 @@ srv_g_scatterplot <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Scatter Plot") - card$append_text("Scatter Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Scatter Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 8a2b8cf3e..80184fba8 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -353,11 +353,13 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Scatter Plot Matrix") - card$append_text("Scatter Plot Matrix", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Scatter Plot Matrix", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 475dad2fd..205cf3a03 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -1200,12 +1200,17 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() sum_type <- input$summary_type title <- if (sum_type == "By Variable Levels") paste0(sum_type, " Table") else paste0(sum_type, " Plot") title_dataname <- paste(title, dataname, sep = " - ") - card$set_name(paste("Missing Data", sum_type, dataname, sep = " - ")) + label <- if (label == "") { + paste("Missing Data", sum_type, dataname, sep = " - ") + } else { + label + } + card$set_name(label) card$append_text(title_dataname, "header2") if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) if (sum_type == "Summary") { diff --git a/R/tm_outliers.R b/R/tm_outliers.R index fba0c5ceb..f30ac883f 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -1146,13 +1146,14 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() + card_fun <- function(comment, label) { tab_type <- input$tabs - card$set_name(paste0("Outliers - ", tab_type)) - card$append_text(tab_type, "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) - + card <- teal::report_card_template( + title = paste0("Outliers - ", tab_type), + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) if (length(categorical_var) > 0) { summary_table <- common_code_q()[["summary_table"]] diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 0d864c293..a31d68f3e 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -351,11 +351,13 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Cross Table") - card$append_text("Cross Table", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Cross Table", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 24eea5744..1e4400a40 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -500,11 +500,13 @@ srv_variable_browser <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Variable Browser Plot") - card$append_text("Variable Browser Plot", "header2") - if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) + card_fun <- function(comment, label) { + card <- teal::report_card_template( + title = "Variable Browser Plot", + label = label, + with_filter = with_filter, + filter_panel_api = filter_panel_api + ) card$append_text("Plot", "header3") card$append_plot(variable_plot_r(), dim = pws$dim()) if (!comment == "") {