From 084ed2e6105bbfda35a7e13e0b40844f126cfaad Mon Sep 17 00:00:00 2001 From: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com> Date: Tue, 10 Dec 2024 02:16:37 +0100 Subject: [PATCH] Fix a couple of lints (#469) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * init * document, styler --------- Co-authored-by: Daniel Co-authored-by: Rémi Thériault <13123390+rempsyc@users.noreply.github.com> --- R/report.BFBayesFactor.R | 1 - R/report.R | 1 - R/report.aov.R | 5 ----- R/report.bayesfactor_models.R | 2 -- R/report.brmsfit.R | 1 - R/report.character.R | 7 ------- R/report.data.frame.R | 15 --------------- R/report.factor.R | 3 --- R/report.lavaan.R | 2 -- R/report.lm.R | 5 ----- R/report.numeric.R | 4 ---- R/report.sessionInfo.R | 5 ----- R/report_effectsize.R | 2 -- R/report_htest_cor.R | 1 - R/report_info.R | 2 -- R/report_intercept.R | 1 - R/report_misc.R | 1 - R/report_model.R | 1 - R/report_parameters.R | 2 -- R/report_performance.R | 2 -- R/report_priors.R | 1 - R/report_random.R | 1 - R/report_sample.R | 3 --- R/report_table.R | 4 ---- R/utils_combine_tables.R | 2 -- man/report-package.Rd | 12 ++++++------ tests/testthat/test-format_model.R | 2 -- tests/testthat/test-report.aov.R | 4 ++-- tests/testthat/test-report.lmer.R | 4 ++-- 29 files changed, 10 insertions(+), 86 deletions(-) diff --git a/R/report.BFBayesFactor.R b/R/report.BFBayesFactor.R index b6f597c9..2f7fc65b 100644 --- a/R/report.BFBayesFactor.R +++ b/R/report.BFBayesFactor.R @@ -63,7 +63,6 @@ report.BFBayesFactor <- function(x, h0 = "H0", h1 = "H1", ...) { } - #' @rdname report.BFBayesFactor #' @export report_statistics.BFBayesFactor <- function(x, table = NULL, ...) { diff --git a/R/report.R b/R/report.R index 73073b17..70b8fe31 100644 --- a/R/report.R +++ b/R/report.R @@ -141,7 +141,6 @@ as.report <- function(text, table = NULL, plot = NULL, ...) { } - #' @rdname as.report #' @export is.report <- function(x) inherits(x, "report") diff --git a/R/report.aov.R b/R/report.aov.R index f5ce5286..e810127e 100644 --- a/R/report.aov.R +++ b/R/report.aov.R @@ -83,7 +83,6 @@ report_effectsize.aov <- function(x, ...) { parameters <- paste0(interpretation, " (", statistics, ")") - as.report_effectsize(parameters, summary = parameters, table = table, @@ -211,9 +210,6 @@ report_statistics.anova <- report_statistics.aov report_statistics.aovlist <- report_statistics.aov - - - # report_parameters ------------------------------------------------------------ @@ -319,7 +315,6 @@ report_info.anova <- report_info.aov report_info.aovlist <- report_info.aov - # report_text ------------------------------------------------------------ #' @rdname report.aov diff --git a/R/report.bayesfactor_models.R b/R/report.bayesfactor_models.R index 2547ff8f..d76fd9a2 100644 --- a/R/report.bayesfactor_models.R +++ b/R/report.bayesfactor_models.R @@ -99,7 +99,6 @@ report_text.bayesfactor_models <- function(x, } - #' @keywords internal .report.bayesfactor_models <- function(model, interpretation = "jeffreys1961", @@ -211,7 +210,6 @@ report_text.bayesfactor_models <- function(x, } - # bayesfactor_inclusion --------------------------------------------------- #' @rdname report.bayesfactor_models diff --git a/R/report.brmsfit.R b/R/report.brmsfit.R index 0ffee6db..057c5cd2 100644 --- a/R/report.brmsfit.R +++ b/R/report.brmsfit.R @@ -53,7 +53,6 @@ report_text.brmsfit <- report_text.lm # ==================== Specific to Bayes =================================== - # report_priors ----------------------------------------------------------- #' @export diff --git a/R/report.character.R b/R/report.character.R index 16fe8fc3..39f999a4 100644 --- a/R/report.character.R +++ b/R/report.character.R @@ -25,13 +25,9 @@ report.character <- function(x, } - - - # report_table ------------------------------------------------------------ - #' @export report_table.character <- function(x, n_entries = 3, @@ -68,7 +64,6 @@ report_table.character <- function(x, } - # report_parameters ------------------------------------------------------- #' @export @@ -102,7 +97,6 @@ report_parameters.character <- function(x, } - # report_text ------------------------------------------------------------- #' @export @@ -175,7 +169,6 @@ report_text.character <- function(x, } - # report_statistics ------------------------------------------------------- diff --git a/R/report.data.frame.R b/R/report.data.frame.R index d5a97bf5..22d910ac 100644 --- a/R/report.data.frame.R +++ b/R/report.data.frame.R @@ -100,7 +100,6 @@ report.data.frame <- function(x, # report_table ------------------------------------------------------------ - #' @export report_table.data.frame <- function(x, n = FALSE, @@ -178,12 +177,9 @@ report_table.data.frame <- function(x, } - - # report_parameters ------------------------------------------------------- - #' @export report_parameters.data.frame <- function(x, table = NULL, @@ -224,7 +220,6 @@ report_parameters.data.frame <- function(x, } - # report_text ------------------------------------------------------------- #' @export @@ -272,7 +267,6 @@ report_text.data.frame <- function(x, } - # report_statistics ------------------------------------------------------- @@ -401,8 +395,6 @@ report_table.grouped_df <- function(x, } - - #' @export report_parameters.grouped_df <- function(x, table = NULL, @@ -494,7 +486,6 @@ report_text.grouped_df <- function(x, report.grouped_df <- report.data.frame - #' @export report_statistics.grouped_df <- function(x, table = NULL, @@ -538,12 +529,6 @@ report_statistics.grouped_df <- function(x, } - - - - - - # Utils ------------------------------------------------------------------- #' @keywords internal diff --git a/R/report.factor.R b/R/report.factor.R index acdf2502..2a805862 100644 --- a/R/report.factor.R +++ b/R/report.factor.R @@ -20,7 +20,6 @@ report.Date <- report.factor # report_table ------------------------------------------------------------ - #' @export report_table.factor <- function(x, levels_percentage = "auto", ...) { if (!is.factor(x)) { @@ -56,7 +55,6 @@ report_table.Date <- report_table.factor # report_parameters ------------------------------------------------------- - #' @export report_parameters.factor <- function(x, table = NULL, levels_percentage = "auto", ...) { if (!is.factor(x)) { @@ -140,7 +138,6 @@ report_text.logical <- report_text.factor report_text.Date <- report_text.factor - # report_statistics ------------------------------------------------------- diff --git a/R/report.lavaan.R b/R/report.lavaan.R index a2fc8b42..9a5dddc5 100644 --- a/R/report.lavaan.R +++ b/R/report.lavaan.R @@ -34,7 +34,6 @@ report.lavaan <- function(x, ...) { } - #' @export report_table.lavaan <- function(x, ...) { parameters <- parameters::model_parameters(x, ci_random = FALSE, ...) @@ -80,7 +79,6 @@ report_table.lavaan <- function(x, ...) { } - #' @rdname report.lavaan #' @export report_performance.lavaan <- function(x, table = NULL, ...) { diff --git a/R/report.lm.R b/R/report.lm.R index 69df2167..239fd111 100644 --- a/R/report.lm.R +++ b/R/report.lm.R @@ -65,7 +65,6 @@ report.lm <- function(x, include_effectsize = TRUE, effectsize_method = "refit", } - # report_effectsize ------------------------------------------------------- #' @rdname report.lm @@ -124,7 +123,6 @@ report_effectsize.lm <- function(x, effectsize_method = "refit", ...) { } - # report_table ------------------------------------------------------------ @@ -278,7 +276,6 @@ report_statistics.lm <- function(x, } - # report_statistics ------------------------------------------------------------ #' @rdname report.lm @@ -475,7 +472,6 @@ report_performance.lm <- function(x, table = NULL, ...) { } - # report_info ------------------------------------------------------------ #' @rdname report.lm @@ -518,7 +514,6 @@ report_info.lm <- function(x, } - # report_text ------------------------------------------------------------ #' @rdname report.lm diff --git a/R/report.numeric.R b/R/report.numeric.R index 631698bf..49bfcab5 100644 --- a/R/report.numeric.R +++ b/R/report.numeric.R @@ -51,7 +51,6 @@ report.numeric <- function(x, } - # report_table ------------------------------------------------------------ #' @export @@ -132,8 +131,6 @@ report_table.numeric <- function(x, } - - # report_parameters ------------------------------------------------------- #' @export @@ -258,7 +255,6 @@ report_parameters.numeric <- function(x, } - # report_text ------------------------------------------------------------- #' @export diff --git a/R/report.sessionInfo.R b/R/report.sessionInfo.R index 8dae6db5..63264b7c 100644 --- a/R/report.sessionInfo.R +++ b/R/report.sessionInfo.R @@ -37,7 +37,6 @@ report.sessionInfo <- function(x, ...) { } - # Aliases ----------------------------------------------------------------- @@ -67,7 +66,6 @@ cite_packages <- function(session = NULL, include_R = TRUE, ...) { } - # report_system -------------------------------------------------------------- @@ -104,7 +102,6 @@ report_system <- function(session = NULL) { } - # report_table ------------------------------------------------------------ #' @export @@ -141,7 +138,6 @@ report_table.sessionInfo <- function(x, include_R = TRUE, ...) { } - # report_parameters ------------------------------------------------------- #' @export @@ -179,7 +175,6 @@ report_parameters.sessionInfo <- function(x, table = NULL, include_R = TRUE, ... } - # report_text ------------------------------------------------------------- #' @export diff --git a/R/report_effectsize.R b/R/report_effectsize.R index 421e7d3e..ac62bea4 100644 --- a/R/report_effectsize.R +++ b/R/report_effectsize.R @@ -83,11 +83,9 @@ print.report_effectsize <- function(x, ...) { } - # Utilities --------------------------------------------------------------- - #' @keywords internal .text_effectsize <- function(interpretation) { # Effect size diff --git a/R/report_htest_cor.R b/R/report_htest_cor.R index 1cf31e48..d8e1d95c 100644 --- a/R/report_htest_cor.R +++ b/R/report_htest_cor.R @@ -24,7 +24,6 @@ } - # report_effectsize --------------------- .report_effectsize_correlation <- function(x, table, dot_args) { diff --git a/R/report_info.R b/R/report_info.R index 395674d8..f73af600 100644 --- a/R/report_info.R +++ b/R/report_info.R @@ -46,7 +46,6 @@ report_info <- function(x, ...) { } - # METHODS ----------------------------------------------------------------- @@ -78,7 +77,6 @@ print.report_info <- function(x, ...) { } - # Utils ------------------------------------------------------------------- #' @keywords internal diff --git a/R/report_intercept.R b/R/report_intercept.R index 884034b6..74e4f9c3 100644 --- a/R/report_intercept.R +++ b/R/report_intercept.R @@ -99,7 +99,6 @@ print.report_intercept <- function(x, ...) { } - .find_reference_level <- function(f) { tryCatch( { diff --git a/R/report_misc.R b/R/report_misc.R index 09bce460..173c9fa9 100644 --- a/R/report_misc.R +++ b/R/report_misc.R @@ -22,7 +22,6 @@ report_date <- function(...) { } - #' @rdname report_date #' @export report_story <- function(...) { diff --git a/R/report_model.R b/R/report_model.R index c9598084..bc2fd7ed 100644 --- a/R/report_model.R +++ b/R/report_model.R @@ -46,7 +46,6 @@ report_model <- function(x, table = NULL, ...) { } - # METHODS ----------------------------------------------------------------- diff --git a/R/report_parameters.R b/R/report_parameters.R index bd0102f7..12e537a7 100644 --- a/R/report_parameters.R +++ b/R/report_parameters.R @@ -104,7 +104,6 @@ print.report_parameters <- function(x, ...) { } - # Utils ------------------------------------------------------------------- #' @keywords internal @@ -158,7 +157,6 @@ print.report_parameters <- function(x, ...) { } - #' @keywords internal .parameters_diagnostic_bayesian <- function(diagnostic, only_when_insufficient = FALSE, ...) { # Convergence diff --git a/R/report_performance.R b/R/report_performance.R index 1d5b2efc..2f60e37e 100644 --- a/R/report_performance.R +++ b/R/report_performance.R @@ -52,7 +52,6 @@ report_performance <- function(x, table = NULL, ...) { } - # METHODS ----------------------------------------------------------------- @@ -85,7 +84,6 @@ print.report_performance <- print.report_text # Utils ------------------------------------------------------------------- - #' @keywords internal .text_r2 <- function(x, info, performance, ...) { text <- "" diff --git a/R/report_priors.R b/R/report_priors.R index 11cbd564..8a287c40 100644 --- a/R/report_priors.R +++ b/R/report_priors.R @@ -25,7 +25,6 @@ report_priors <- function(x, ...) { } - # METHODS ----------------------------------------------------------------- diff --git a/R/report_random.R b/R/report_random.R index 51efe567..74a7d513 100644 --- a/R/report_random.R +++ b/R/report_random.R @@ -47,7 +47,6 @@ report_random <- function(x, ...) { } - # METHODS ----------------------------------------------------------------- diff --git a/R/report_sample.R b/R/report_sample.R index 83b95115..14918e28 100644 --- a/R/report_sample.R +++ b/R/report_sample.R @@ -325,7 +325,6 @@ report_sample <- function(data, } - .report_sample_row.factor <- function(x, column, weights = NULL, @@ -388,7 +387,6 @@ report_sample <- function(data, .report_sample_row.character <- .report_sample_row.factor - # Standard error for confidence interval of proportions ---- .ci_proportion <- function(x, table_proportions, weights, ci, ci_method, ci_correct) { @@ -446,7 +444,6 @@ report_sample <- function(data, } - # print-method -------------------------------------------- #' @export diff --git a/R/report_table.R b/R/report_table.R index 4a77098e..faa2ae0f 100644 --- a/R/report_table.R +++ b/R/report_table.R @@ -63,7 +63,6 @@ report_table <- function(x, ...) { } - # METHODS ----------------------------------------------------------------- #' @rdname as.report @@ -104,9 +103,6 @@ as.report_table.report <- function(x, summary = NULL, ...) { } - - - #' @export summary.report_table <- function(object, ...) { if (is.null(attributes(object)$summary)) { diff --git a/R/utils_combine_tables.R b/R/utils_combine_tables.R index 7c342db7..05fac632 100644 --- a/R/utils_combine_tables.R +++ b/R/utils_combine_tables.R @@ -14,7 +14,6 @@ } - #' @keywords internal .combine_tables_performance <- function(parameters, performance) { table <- parameters @@ -67,7 +66,6 @@ } - #' @keywords internal .remove_performance <- function(table) { if ("Fit" %in% names(table)) { diff --git a/man/report-package.Rd b/man/report-package.Rd index 43f8fa51..ce41d492 100644 --- a/man/report-package.Rd +++ b/man/report-package.Rd @@ -24,15 +24,15 @@ Useful links: } \author{ -\strong{Maintainer}: Rémi Thériault \email{remi.theriault@mail.mcgill.ca} (\href{https://orcid.org/0000-0003-4315-6788}{ORCID}) (@rempsyc) +\strong{Maintainer}: Rémi Thériault \email{remi.theriault@mail.mcgill.ca} (\href{https://orcid.org/0000-0003-4315-6788}{ORCID}) Authors: \itemize{ - \item Dominique Makowski \email{dom.makowski@gmail.com} (\href{https://orcid.org/0000-0001-5375-9967}{ORCID}) (@Dom_Makowski) - \item Daniel Lüdecke \email{d.luedecke@uke.de} (\href{https://orcid.org/0000-0002-8895-3206}{ORCID}) (@strengejacke) - \item Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) (@patilindrajeets) - \item Mattan S. Ben-Shachar \email{matanshm@post.bgu.ac.il} (\href{https://orcid.org/0000-0002-4287-4801}{ORCID}) (@mattansb) - \item Brenton M. Wiernik \email{brenton@wiernik.org} (\href{https://orcid.org/0000-0001-9560-6336}{ORCID}) (@bmwiernik) + \item Dominique Makowski \email{dom.makowski@gmail.com} (\href{https://orcid.org/0000-0001-5375-9967}{ORCID}) + \item Daniel Lüdecke \email{d.luedecke@uke.de} (\href{https://orcid.org/0000-0002-8895-3206}{ORCID}) + \item Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) + \item Mattan S. Ben-Shachar \email{matanshm@post.bgu.ac.il} (\href{https://orcid.org/0000-0002-4287-4801}{ORCID}) + \item Brenton M. Wiernik \email{brenton@wiernik.org} (\href{https://orcid.org/0000-0001-9560-6336}{ORCID}) } Other contributors: diff --git a/tests/testthat/test-format_model.R b/tests/testthat/test-format_model.R index 3f569a45..a429edde 100644 --- a/tests/testthat/test-format_model.R +++ b/tests/testthat/test-format_model.R @@ -20,8 +20,6 @@ test_that("format_model", { }) - - test_that("format_model", { skip_if_not_installed("rstanarm") expect_identical( diff --git a/tests/testthat/test-report.aov.R b/tests/testthat/test-report.aov.R index 01f33e5c..f25a0b6c 100644 --- a/tests/testthat/test-report.aov.R +++ b/tests/testthat/test-report.aov.R @@ -32,8 +32,8 @@ test_that("report.aov", { expect_equal(sum(as.report_table(r3, summary = TRUE)$Mean_Square), 5.787854, tolerance = 0.01) data <- iris - data$Cat1 <- rep(c("X", "X", "Y"), length.out = nrow(data)) - data$Cat2 <- rep(c("A", "B"), length.out = nrow(data)) + data$Cat1 <- rep_len(c("X", "X", "Y"), nrow(data)) + data$Cat2 <- rep_len(c("A", "B"), nrow(data)) model <- aov(Sepal.Length ~ Species * Cat1 * Cat2, data = data) r4 <- report(model) diff --git a/tests/testthat/test-report.lmer.R b/tests/testthat/test-report.lmer.R index 53421b15..d3a27687 100644 --- a/tests/testthat/test-report.lmer.R +++ b/tests/testthat/test-report.lmer.R @@ -3,12 +3,12 @@ skip_if_not_installed("lme4") test_that("report-lmer", { df <- lme4::sleepstudy set.seed(123) - df$mygrp <- sample(1:5, size = 180, replace = TRUE) + df$mygrp <- sample.int(5, size = 180, replace = TRUE) df$mysubgrp <- NA for (i in 1:5) { filter_group <- df$mygrp == i df$mysubgrp[filter_group] <- - sample(1:30, size = sum(filter_group), replace = TRUE) + sample.int(30, size = sum(filter_group), replace = TRUE) } set.seed(123)