From 2c327386f85a255a7ce331d7c3dae13a15adf5d9 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Mon, 21 Oct 2024 10:05:30 -0700 Subject: [PATCH] suppress package startup messages in tests using: ``` r_files <- list.files(path = "tests/testthat", pattern = "\\.R$", full.names = TRUE) process_file <- function(file_path) { lines <- readLines(file_path) modified_lines <- sapply(lines, function(line) { if (grepl("^\\s*library\\(", line)) { pkg <- gsub("library(", "", line, fixed = TRUE) pkg <- gsub(")", "", pkg, fixed = TRUE) if (pkg %in% c("modeltests", tidyverse::tidyverse_packages(), tidymodels::tidymodels_packages())) { return(line) } return(paste0("suppressPackageStartupMessages(", line, ")")) } else { return(line) } }) writeLines(modified_lines, file_path) } lapply(r_files, process_file) `` --- tests/testthat/test-aer.R | 2 +- tests/testthat/test-betareg.R | 2 +- tests/testthat/test-biglm.R | 2 +- tests/testthat/test-bingroup.R | 2 +- tests/testthat/test-boot.R | 2 +- tests/testthat/test-car.R | 2 +- tests/testthat/test-cluster.R | 2 +- tests/testthat/test-cmprsk.R | 2 +- tests/testthat/test-drc.R | 2 +- tests/testthat/test-emmeans.R | 4 ++-- tests/testthat/test-epiR.R | 4 ++-- tests/testthat/test-ergm.R | 2 +- tests/testthat/test-geepack.R | 2 +- tests/testthat/test-glmnet.R | 2 +- tests/testthat/test-glmnetUtils.R | 2 +- tests/testthat/test-gmm.R | 2 +- tests/testthat/test-joineRML.R | 2 +- tests/testthat/test-kendall.R | 2 +- tests/testthat/test-lavaan.R | 2 +- tests/testthat/test-lmbeta-lm-beta.R | 2 +- tests/testthat/test-lmodel2.R | 2 +- tests/testthat/test-lmtest.R | 4 ++-- tests/testthat/test-margins.R | 2 +- tests/testthat/test-mass-negbin.R | 2 +- tests/testthat/test-mass-polr.R | 2 +- tests/testthat/test-mass-rlm.R | 2 +- tests/testthat/test-mclust.R | 2 +- tests/testthat/test-mediation.R | 2 +- tests/testthat/test-metafor.R | 4 ++-- tests/testthat/test-mfx.R | 2 +- tests/testthat/test-mlogit.R | 4 ++-- tests/testthat/test-muhaz.R | 2 +- tests/testthat/test-multcomp.R | 2 +- tests/testthat/test-nnet.R | 2 +- tests/testthat/test-ordinal.R | 2 +- tests/testthat/test-plm.R | 2 +- tests/testthat/test-polca.R | 2 +- tests/testthat/test-quantreg-nlrq.R | 2 +- tests/testthat/test-quantreg-rq.R | 2 +- tests/testthat/test-quantreg-rqs.R | 2 +- tests/testthat/test-robust.R | 2 +- tests/testthat/test-robustbase.R | 2 +- tests/testthat/test-spdep.R | 4 ++-- tests/testthat/test-speedglm-speedglm.R | 2 +- tests/testthat/test-speedglm-speedlm.R | 2 +- tests/testthat/test-stats-factanal.R | 2 +- tests/testthat/test-stats-prcomp.R | 2 +- tests/testthat/test-survey.R | 2 +- tests/testthat/test-survival-aareg.R | 2 +- tests/testthat/test-survival-cch.R | 2 +- tests/testthat/test-survival-coxph.R | 2 +- tests/testthat/test-survival-pyears.R | 2 +- tests/testthat/test-survival-survdiff.R | 2 +- tests/testthat/test-survival-survexp.R | 2 +- tests/testthat/test-survival-survfit.R | 2 +- tests/testthat/test-survival-survreg.R | 2 +- tests/testthat/test-systemfit.R | 2 +- tests/testthat/test-tseries.R | 6 +++--- tests/testthat/test-vars.R | 2 +- 59 files changed, 67 insertions(+), 67 deletions(-) diff --git a/tests/testthat/test-aer.R b/tests/testthat/test-aer.R index a813ee383..3f7d66d33 100644 --- a/tests/testthat/test-aer.R +++ b/tests/testthat/test-aer.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("AER") -library(AER) +suppressPackageStartupMessages(library(AER)) library(dplyr) library(modeltests) diff --git a/tests/testthat/test-betareg.R b/tests/testthat/test-betareg.R index fd593e783..54f32ec3d 100644 --- a/tests/testthat/test-betareg.R +++ b/tests/testthat/test-betareg.R @@ -5,7 +5,7 @@ library(modeltests) skip_if_not_installed("betareg") -library(betareg) +suppressPackageStartupMessages(library(betareg)) data("GasolineYield") fit1 <- betareg(yield ~ batch + temp, data = GasolineYield) diff --git a/tests/testthat/test-biglm.R b/tests/testthat/test-biglm.R index 6088a5d11..be0493c17 100644 --- a/tests/testthat/test-biglm.R +++ b/tests/testthat/test-biglm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("biglm") -library(biglm) +suppressPackageStartupMessages(library(biglm)) fit <- biglm(mpg ~ wt + disp, mtcars) fit2 <- bigglm(am ~ mpg, mtcars, family = binomial()) diff --git a/tests/testthat/test-bingroup.R b/tests/testthat/test-bingroup.R index 4abdb6107..c8d41eb80 100644 --- a/tests/testthat/test-bingroup.R +++ b/tests/testthat/test-bingroup.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("binGroup") -library(binGroup) +suppressPackageStartupMessages(library(binGroup)) bw <- binWidth(100, .1) bd <- binDesign(nmax = 300, delta = 0.06, p.hyp = 0.1, power = .8) diff --git a/tests/testthat/test-boot.R b/tests/testthat/test-boot.R index 5847ba5e2..e5e7deaf6 100644 --- a/tests/testthat/test-boot.R +++ b/tests/testthat/test-boot.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("boot") -library(boot) +suppressPackageStartupMessages(library(boot)) test_that("boot tidier arguments", { check_arguments(tidy.boot) diff --git a/tests/testthat/test-car.R b/tests/testthat/test-car.R index e60207cbd..8c8b9cd42 100644 --- a/tests/testthat/test-car.R +++ b/tests/testthat/test-car.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) skip_if_not_installed("car") diff --git a/tests/testthat/test-cluster.R b/tests/testthat/test-cluster.R index 641f51259..b1ab9dbc7 100644 --- a/tests/testthat/test-cluster.R +++ b/tests/testthat/test-cluster.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("cluster") -library(cluster) +suppressPackageStartupMessages(library(cluster)) skip_if_not_installed("modeldata") library(modeldata) diff --git a/tests/testthat/test-cmprsk.R b/tests/testthat/test-cmprsk.R index dd0221121..f9b5d91f0 100644 --- a/tests/testthat/test-cmprsk.R +++ b/tests/testthat/test-cmprsk.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("cmprsk") -library(cmprsk) +suppressPackageStartupMessages(library(cmprsk)) set.seed(2) # simulate data diff --git a/tests/testthat/test-drc.R b/tests/testthat/test-drc.R index 9eea9a445..f79ea76ff 100644 --- a/tests/testthat/test-drc.R +++ b/tests/testthat/test-drc.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("drc") -library(drc) +suppressPackageStartupMessages(library(drc)) mod <- drm(dead / total ~ conc, type, weights = total, data = selenium, fct = LL.2(), type = "binomial" diff --git a/tests/testthat/test-emmeans.R b/tests/testthat/test-emmeans.R index 5bc091dc6..47e073838 100644 --- a/tests/testthat/test-emmeans.R +++ b/tests/testthat/test-emmeans.R @@ -7,10 +7,10 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("lsmeans") -library(lsmeans) +suppressPackageStartupMessages(library(lsmeans)) skip_if_not_installed("lme4") -library(lme4) +suppressPackageStartupMessages(library(lme4)) fit <- lm(sales1 ~ price1 + price2 + day + store, data = oranges) rg <- ref.grid(fit) diff --git a/tests/testthat/test-epiR.R b/tests/testthat/test-epiR.R index 843a90965..6e730e7d3 100644 --- a/tests/testthat/test-epiR.R +++ b/tests/testthat/test-epiR.R @@ -7,7 +7,7 @@ rownames(dat) <- c("DF+", "DF-") colnames(dat) <- c("FUS+", "FUS-") skip_if_not_installed("MASS") -library(MASS) +suppressPackageStartupMessages(library(MASS)) birthwt <- MASS::birthwt birthwt$low <- factor(birthwt$low, levels = c(1, 0)) @@ -18,7 +18,7 @@ tab2 <- table(birthwt$smoke, birthwt$low, birthwt$race, dnn = c("Smoke", "Low BW", "Race") ) -library(epiR) +suppressPackageStartupMessages(library(epiR)) fit1 <- epi.2by2( dat = as.table(dat), method = "cross.sectional", conf.level = 0.95, units = 100, outcome = "as.columns" diff --git a/tests/testthat/test-ergm.R b/tests/testthat/test-ergm.R index 92997b587..c9a0531a4 100644 --- a/tests/testthat/test-ergm.R +++ b/tests/testthat/test-ergm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("ergm") -library(ergm) +suppressPackageStartupMessages(library(ergm)) data(florentine) data(faux.mesa.high) diff --git a/tests/testthat/test-geepack.R b/tests/testthat/test-geepack.R index f12002785..f4237ecde 100644 --- a/tests/testthat/test-geepack.R +++ b/tests/testthat/test-geepack.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("geepack") -library(geepack) +suppressPackageStartupMessages(library(geepack)) dat <- data.frame(state.region, state.x77) diff --git a/tests/testthat/test-glmnet.R b/tests/testthat/test-glmnet.R index 5fcc7d1de..50bdc6a9d 100644 --- a/tests/testthat/test-glmnet.R +++ b/tests/testthat/test-glmnet.R @@ -2,7 +2,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("glmnet") -library(glmnet) +suppressPackageStartupMessages(library(glmnet)) set.seed(27) diff --git a/tests/testthat/test-glmnetUtils.R b/tests/testthat/test-glmnetUtils.R index 3bde69a77..3e32646cb 100644 --- a/tests/testthat/test-glmnetUtils.R +++ b/tests/testthat/test-glmnetUtils.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("glmnetUtils") -library(glmnetUtils) +suppressPackageStartupMessages(library(glmnetUtils)) set.seed(27) diff --git a/tests/testthat/test-gmm.R b/tests/testthat/test-gmm.R index 78d4423fa..a0ca32091 100644 --- a/tests/testthat/test-gmm.R +++ b/tests/testthat/test-gmm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("gmm") -library(gmm) +suppressPackageStartupMessages(library(gmm)) data(Finance) diff --git a/tests/testthat/test-joineRML.R b/tests/testthat/test-joineRML.R index 8db60e242..b699f5e99 100644 --- a/tests/testthat/test-joineRML.R +++ b/tests/testthat/test-joineRML.R @@ -7,7 +7,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("joineRML") -library(joineRML) +suppressPackageStartupMessages(library(joineRML)) # NOTE: the models used in these tests are created in # `data-raw/fit_and_save_long_running_models.R`, and then are saved to diff --git a/tests/testthat/test-kendall.R b/tests/testthat/test-kendall.R index 12822df67..e4e4f0aed 100644 --- a/tests/testthat/test-kendall.R +++ b/tests/testthat/test-kendall.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("Kendall") -library(Kendall) +suppressPackageStartupMessages(library(Kendall)) a <- c(2.5, 2.5, 2.5, 2.5, 5, 6.5, 6.5, 10, 10, 10, 10, 10, 14, 14, 14, 16, 17) b <- c(1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2) diff --git a/tests/testthat/test-lavaan.R b/tests/testthat/test-lavaan.R index 712134880..801c77eb2 100644 --- a/tests/testthat/test-lavaan.R +++ b/tests/testthat/test-lavaan.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("lavaan") -library(lavaan) +suppressPackageStartupMessages(library(lavaan)) fit <- sem("mpg ~ wt", data = mtcars) form <- paste("F =~", paste0("x", 1:9, collapse = " + ")) diff --git a/tests/testthat/test-lmbeta-lm-beta.R b/tests/testthat/test-lmbeta-lm-beta.R index d09c050c9..2578f13f6 100644 --- a/tests/testthat/test-lmbeta-lm-beta.R +++ b/tests/testthat/test-lmbeta-lm-beta.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("lm.beta") -library(lm.beta) +suppressPackageStartupMessages(library(lm.beta)) test_that("lm.beta tidier arguments", { check_arguments(tidy.lm.beta) diff --git a/tests/testthat/test-lmodel2.R b/tests/testthat/test-lmodel2.R index 078053cc0..5c2b9f680 100644 --- a/tests/testthat/test-lmodel2.R +++ b/tests/testthat/test-lmodel2.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("lmodel2") -library(lmodel2) +suppressPackageStartupMessages(library(lmodel2)) data("mod2ex2") fit <- lmodel2(Prey ~ Predators, data = mod2ex2, "relative", "relative", 99) diff --git a/tests/testthat/test-lmtest.R b/tests/testthat/test-lmtest.R index eaa1d8ec4..eb9c10bbf 100644 --- a/tests/testthat/test-lmtest.R +++ b/tests/testthat/test-lmtest.R @@ -4,10 +4,10 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("lmtest") -library(lmtest) +suppressPackageStartupMessages(library(lmtest)) skip_if_not_installed("sandwich") -library(sandwich) +suppressPackageStartupMessages(library(sandwich)) m <- lm(dist ~ speed, data = cars) ct <- lmtest::coeftest(m) diff --git a/tests/testthat/test-margins.R b/tests/testthat/test-margins.R index deb8b10f4..af7ad1372 100644 --- a/tests/testthat/test-margins.R +++ b/tests/testthat/test-margins.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("margins") -library(margins) +suppressPackageStartupMessages(library(margins)) fit1 <- glm(am ~ cyl + hp + wt, data = mtcars, family = binomial) marg1 <- margins(fit1) diff --git a/tests/testthat/test-mass-negbin.R b/tests/testthat/test-mass-negbin.R index e5e9030c9..be2604f89 100644 --- a/tests/testthat/test-mass-negbin.R +++ b/tests/testthat/test-mass-negbin.R @@ -2,7 +2,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("MASS") -library(MASS) +suppressPackageStartupMessages(library(MASS)) fit <- glm.nb(Days ~ Sex / (Age + Eth * Lrn), data = MASS::quine) diff --git a/tests/testthat/test-mass-polr.R b/tests/testthat/test-mass-polr.R index 7d7c7c0c2..f6ea2f80f 100644 --- a/tests/testthat/test-mass-polr.R +++ b/tests/testthat/test-mass-polr.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("MASS") -library(MASS) +suppressPackageStartupMessages(library(MASS)) fit <- polr( Sat ~ Infl + Type + Cont, diff --git a/tests/testthat/test-mass-rlm.R b/tests/testthat/test-mass-rlm.R index c148b3da3..3c3cb30ac 100644 --- a/tests/testthat/test-mass-rlm.R +++ b/tests/testthat/test-mass-rlm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("MASS") -library(MASS) +suppressPackageStartupMessages(library(MASS)) fit <- rlm(stack.loss ~ ., stackloss) diff --git a/tests/testthat/test-mclust.R b/tests/testthat/test-mclust.R index db95f1078..beb31abae 100644 --- a/tests/testthat/test-mclust.R +++ b/tests/testthat/test-mclust.R @@ -7,7 +7,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("mclust") -library(mclust) +suppressPackageStartupMessages(library(mclust)) skip_if_not_installed("modeldata") library(modeldata) diff --git a/tests/testthat/test-mediation.R b/tests/testthat/test-mediation.R index cb54d5d1a..f21fdc466 100644 --- a/tests/testthat/test-mediation.R +++ b/tests/testthat/test-mediation.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("mediation") -library(mediation) +suppressPackageStartupMessages(library(mediation)) data(jobs) b <- lm(job_seek ~ treat + econ_hard + sex + age, data = jobs) diff --git a/tests/testthat/test-metafor.R b/tests/testthat/test-metafor.R index aedd53527..1479dcca0 100644 --- a/tests/testthat/test-metafor.R +++ b/tests/testthat/test-metafor.R @@ -7,10 +7,10 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("metafor") -library(metafor) +suppressPackageStartupMessages(library(metafor)) skip_if_not_installed("lme4") -library(lme4) +suppressPackageStartupMessages(library(lme4)) # check arguments --------------------------------------------------------- diff --git a/tests/testthat/test-mfx.R b/tests/testthat/test-mfx.R index 55759c73e..d032285c5 100644 --- a/tests/testthat/test-mfx.R +++ b/tests/testthat/test-mfx.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("mfx") -library(mfx) +suppressPackageStartupMessages(library(mfx)) # simulate data set.seed(12345) diff --git a/tests/testthat/test-mlogit.R b/tests/testthat/test-mlogit.R index bf3c9d41b..0fe824e1b 100644 --- a/tests/testthat/test-mlogit.R +++ b/tests/testthat/test-mlogit.R @@ -5,8 +5,8 @@ library(modeltests) skip_if_not_installed("mlogit") skip_if_not_installed("AER") -library(mlogit) -library(AER) +suppressPackageStartupMessages(library(mlogit)) +suppressPackageStartupMessages(library(AER)) library(dplyr) data("Fishing", package = "mlogit") diff --git a/tests/testthat/test-muhaz.R b/tests/testthat/test-muhaz.R index 7e2bef091..c7d7b009f 100644 --- a/tests/testthat/test-muhaz.R +++ b/tests/testthat/test-muhaz.R @@ -6,7 +6,7 @@ library(modeltests) skip_if_not_installed("muhaz") skip_if_not_installed("survival") # does this skip with base R? -library(muhaz) +suppressPackageStartupMessages(library(muhaz)) # load the ovarian data data(cancer, package = "survival") diff --git a/tests/testthat/test-multcomp.R b/tests/testthat/test-multcomp.R index a55247e79..862e5e2dc 100644 --- a/tests/testthat/test-multcomp.R +++ b/tests/testthat/test-multcomp.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("multcomp") -library(multcomp) +suppressPackageStartupMessages(library(multcomp)) amod <- aov(breaks ~ wool + tension, data = warpbreaks) wht <- glht(amod, linfct = mcp(tension = "Tukey")) diff --git a/tests/testthat/test-nnet.R b/tests/testthat/test-nnet.R index 76e65617e..8ddf45481 100644 --- a/tests/testthat/test-nnet.R +++ b/tests/testthat/test-nnet.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("nnet") -library(nnet) +suppressPackageStartupMessages(library(nnet)) fit <- multinom(gear ~ mpg + factor(am), data = mtcars, trace = FALSE) diff --git a/tests/testthat/test-ordinal.R b/tests/testthat/test-ordinal.R index 7b5b6e6b7..952173b6d 100644 --- a/tests/testthat/test-ordinal.R +++ b/tests/testthat/test-ordinal.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("ordinal") -library(ordinal) +suppressPackageStartupMessages(library(ordinal)) fit <- clm(rating ~ temp * contact, data = wine) diff --git a/tests/testthat/test-plm.R b/tests/testthat/test-plm.R index 0ef742c63..5c7a6cb58 100644 --- a/tests/testthat/test-plm.R +++ b/tests/testthat/test-plm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("plm") -library(plm) +suppressPackageStartupMessages(library(plm)) data(Produc, package = "plm") fit <- plm( diff --git a/tests/testthat/test-polca.R b/tests/testthat/test-polca.R index 86e7a1e4c..db80fae0e 100644 --- a/tests/testthat/test-polca.R +++ b/tests/testthat/test-polca.R @@ -5,7 +5,7 @@ library(modeltests) skip_if_not_installed("poLCA") skip_if_not_installed("MASS") -library(poLCA) +suppressPackageStartupMessages(library(poLCA)) data(values) fit <- poLCA(cbind(A, B, C, D) ~ 1, values, nclass = 2, verbose = FALSE) diff --git a/tests/testthat/test-quantreg-nlrq.R b/tests/testthat/test-quantreg-nlrq.R index 383280e10..8cb8dd413 100644 --- a/tests/testthat/test-quantreg-nlrq.R +++ b/tests/testthat/test-quantreg-nlrq.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("quantreg") -library(quantreg) +suppressPackageStartupMessages(library(quantreg)) set.seed(27) diff --git a/tests/testthat/test-quantreg-rq.R b/tests/testthat/test-quantreg-rq.R index 02e16b7c0..731df38cb 100644 --- a/tests/testthat/test-quantreg-rq.R +++ b/tests/testthat/test-quantreg-rq.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("quantreg") -library(quantreg) +suppressPackageStartupMessages(library(quantreg)) data(stackloss) diff --git a/tests/testthat/test-quantreg-rqs.R b/tests/testthat/test-quantreg-rqs.R index 8ddc1702f..7a70b71d9 100644 --- a/tests/testthat/test-quantreg-rqs.R +++ b/tests/testthat/test-quantreg-rqs.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("quantreg") -library(quantreg) +suppressPackageStartupMessages(library(quantreg)) airquality <- na.omit(airquality) diff --git a/tests/testthat/test-robust.R b/tests/testthat/test-robust.R index dab650079..0dcc15702 100644 --- a/tests/testthat/test-robust.R +++ b/tests/testthat/test-robust.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("robust") -library(robust) +suppressPackageStartupMessages(library(robust)) fit <- lmRob(mpg ~ wt, data = mtcars) fit2 <- glmRob(am ~ wt, data = mtcars, family = "binomial") diff --git a/tests/testthat/test-robustbase.R b/tests/testthat/test-robustbase.R index 28fe6da81..931c6cc66 100644 --- a/tests/testthat/test-robustbase.R +++ b/tests/testthat/test-robustbase.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("robustbase") -library(robustbase) +suppressPackageStartupMessages(library(robustbase)) fit <- lmrob(mpg ~ wt, data = mtcars) fit2 <- glmrob(am ~ wt, data = mtcars, family = "binomial") diff --git a/tests/testthat/test-spdep.R b/tests/testthat/test-spdep.R index a47b1eb7c..e9fc07422 100644 --- a/tests/testthat/test-spdep.R +++ b/tests/testthat/test-spdep.R @@ -4,10 +4,10 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("spdep") -library(spdep) +suppressPackageStartupMessages(library(spdep)) skip_if_not_installed("spatialreg") -library(spatialreg) +suppressPackageStartupMessages(library(spatialreg)) data(oldcol, package = "spdep") listw <- spdep::nb2listw(COL.nb, style = "W") diff --git a/tests/testthat/test-speedglm-speedglm.R b/tests/testthat/test-speedglm-speedglm.R index 701c04e3d..8b3c348ce 100644 --- a/tests/testthat/test-speedglm-speedglm.R +++ b/tests/testthat/test-speedglm-speedglm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("speedglm") -library(speedglm) +suppressPackageStartupMessages(library(speedglm)) clotting <- data.frame( u = c(5, 10, 15, 20, 30, 40, 60, 80, 100), diff --git a/tests/testthat/test-speedglm-speedlm.R b/tests/testthat/test-speedglm-speedlm.R index 55855976e..3d3c5e34c 100644 --- a/tests/testthat/test-speedglm-speedlm.R +++ b/tests/testthat/test-speedglm-speedlm.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("speedglm") -library(speedglm) +suppressPackageStartupMessages(library(speedglm)) fit <- speedlm(mpg ~ wt, mtcars, fitted = TRUE) fit2 <- speedlm(mpg ~ wt + disp, mtcars, fitted = TRUE) diff --git a/tests/testthat/test-stats-factanal.R b/tests/testthat/test-stats-factanal.R index f42904b33..4d6b5580d 100644 --- a/tests/testthat/test-stats-factanal.R +++ b/tests/testthat/test-stats-factanal.R @@ -61,7 +61,7 @@ test_that("augment.factanal works", { }) test_that("augment.factanal works with matrix", { - library(broom) +suppressPackageStartupMessages( library(broom)) set.seed(123) # data diff --git a/tests/testthat/test-stats-prcomp.R b/tests/testthat/test-stats-prcomp.R index c1058571e..262c20723 100644 --- a/tests/testthat/test-stats-prcomp.R +++ b/tests/testthat/test-stats-prcomp.R @@ -57,7 +57,7 @@ test_that("augment.prcomp", { }) test_that("augment.prcomp works with matrix objects", { - library(broom) +suppressPackageStartupMessages( library(broom)) set.seed(17) # data diff --git a/tests/testthat/test-survey.R b/tests/testthat/test-survey.R index 482173c7d..e8ec76dd5 100644 --- a/tests/testthat/test-survey.R +++ b/tests/testthat/test-survey.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survey") -library(survey) +suppressPackageStartupMessages(library(survey)) skip_if_not_installed("MASS") diff --git a/tests/testthat/test-survival-aareg.R b/tests/testthat/test-survival-aareg.R index bd950ddef..084e70955 100644 --- a/tests/testthat/test-survival-aareg.R +++ b/tests/testthat/test-survival-aareg.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) afit1 <- aareg( Surv(time, status) ~ age + sex + ph.ecog, diff --git a/tests/testthat/test-survival-cch.R b/tests/testthat/test-survival-cch.R index b1d2efbf0..a37b8d751 100644 --- a/tests/testthat/test-survival-cch.R +++ b/tests/testthat/test-survival-cch.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) subcoh <- nwtco$in.subcohort selccoh <- with(nwtco, rel == 1 | subcoh == 1) diff --git a/tests/testthat/test-survival-coxph.R b/tests/testthat/test-survival-coxph.R index 988f5747f..0ce6515b5 100644 --- a/tests/testthat/test-survival-coxph.R +++ b/tests/testthat/test-survival-coxph.R @@ -2,7 +2,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) fit <- coxph(Surv(time, status) ~ age + sex, lung) fit2 <- coxph(Surv(time, status) ~ age + sex, lung, robust = TRUE) diff --git a/tests/testthat/test-survival-pyears.R b/tests/testthat/test-survival-pyears.R index a61c089f0..c473b2eeb 100644 --- a/tests/testthat/test-survival-pyears.R +++ b/tests/testthat/test-survival-pyears.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) temp.yr <- tcut(mgus$dxyr, 55:92, labels = as.character(55:91)) temp.age <- tcut(mgus$age, 34:101, labels = as.character(34:100)) diff --git a/tests/testthat/test-survival-survdiff.R b/tests/testthat/test-survival-survdiff.R index 8f8a8d632..3e2797b76 100644 --- a/tests/testthat/test-survival-survdiff.R +++ b/tests/testthat/test-survival-survdiff.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) fit <- survdiff(Surv(futime, fustat) ~ rx, data = ovarian) fit2 <- survdiff(Surv(time, status) ~ pat.karno + strata(inst), data = lung) diff --git a/tests/testthat/test-survival-survexp.R b/tests/testthat/test-survival-survexp.R index 36b12addc..2de94dac6 100644 --- a/tests/testthat/test-survival-survexp.R +++ b/tests/testthat/test-survival-survexp.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) fit <- suppressWarnings( survexp( diff --git a/tests/testthat/test-survival-survfit.R b/tests/testthat/test-survival-survfit.R index 8cb061c45..d233ee14d 100644 --- a/tests/testthat/test-survival-survfit.R +++ b/tests/testthat/test-survival-survfit.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) cfit <- coxph(Surv(time, status) ~ age + strata(sex), lung) sfit <- survfit(cfit) diff --git a/tests/testthat/test-survival-survreg.R b/tests/testthat/test-survival-survreg.R index cd9682655..7fc37e97f 100644 --- a/tests/testthat/test-survival-survreg.R +++ b/tests/testthat/test-survival-survreg.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("survival") -library(survival) +suppressPackageStartupMessages(library(survival)) sr <- survreg(Surv(futime, fustat) ~ ecog.ps + rx, ovarian, dist = "exponential" diff --git a/tests/testthat/test-systemfit.R b/tests/testthat/test-systemfit.R index c4a3ad251..98fb4abcd 100644 --- a/tests/testthat/test-systemfit.R +++ b/tests/testthat/test-systemfit.R @@ -4,7 +4,7 @@ skip_if_not_installed("modeltests") library(modeltests) skip_if_not_installed("systemfit") -library(systemfit) +suppressPackageStartupMessages(library(systemfit)) # Testing using systemfit examples ---------------------------------------- diff --git a/tests/testthat/test-tseries.R b/tests/testthat/test-tseries.R index 01ec4556d..3312963c4 100644 --- a/tests/testthat/test-tseries.R +++ b/tests/testthat/test-tseries.R @@ -1,8 +1,8 @@ skip_if_not_installed("modeltests") -library(modeltests) +suppressPackageStartupMessages(library(modeltests)) -skip_if_not_installed("tseries") -library(tseries) +suppressMessages(skip_if_not_installed("tseries")) +suppressPackageStartupMessages(library(tseries)) dax <- diff(log(EuStockMarkets))[, "DAX"] fit <- garch(dax, control = garch.control(trace = FALSE)) diff --git a/tests/testthat/test-vars.R b/tests/testthat/test-vars.R index 3ad4219d9..8b85b519c 100644 --- a/tests/testthat/test-vars.R +++ b/tests/testthat/test-vars.R @@ -2,7 +2,7 @@ skip_on_cran() skip_if_not_installed("modeltests") skip_if_not_installed("vars") -library(vars) +suppressPackageStartupMessages(library(vars)) library(modeltests) data("Canada", package = "vars")