From edb265055840b25997830d35a260ef223c4bb5af Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 4 Oct 2024 13:17:36 +0200 Subject: [PATCH] use httr2 instead of httr --- DESCRIPTION | 1 - tests/testthat/test-bayesfactor_parameters.R | 4 ++-- tests/testthat/test-brms.R | 6 +++--- tests/testthat/test-ci.R | 4 ++-- tests/testthat/test-describe_posterior.R | 12 ++++++------ tests/testthat/test-describe_prior.R | 2 +- tests/testthat/test-hdi.R | 8 ++++---- tests/testthat/test-point_estimate.R | 4 ++-- tests/testthat/test-print.R | 2 +- tests/testthat/test-rstanarm.R | 10 +++++----- tests/testthat/test-spi.R | 8 ++++---- vignettes/mediation.Rmd | 6 +++--- 12 files changed, 33 insertions(+), 34 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d5cde17f4..510285a23 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -89,7 +89,6 @@ Suggests: ggdist, ggplot2, glmmTMB, - httr, httr2, KernSmooth, knitr, diff --git a/tests/testthat/test-bayesfactor_parameters.R b/tests/testthat/test-bayesfactor_parameters.R index ff821f432..feef8baf6 100644 --- a/tests/testthat/test-bayesfactor_parameters.R +++ b/tests/testthat/test-bayesfactor_parameters.R @@ -57,7 +57,7 @@ test_that("bayesfactor_parameters RSTANARM", { skip_if_offline() skip_if_not_or_load_if_installed("logspline", "2.1.21") skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") fit <- suppressMessages(stan_glm(mpg ~ ., data = mtcars, refresh = 0)) @@ -93,7 +93,7 @@ test_that("bayesfactor_parameters RSTANARM", { test_that("bayesfactor_parameters BRMS", { skip_if_offline() skip_if_not_or_load_if_installed("logspline", "2.1.21") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("brms") skip_if_not_or_load_if_installed("cmdstanr") skip_if_not(dir.exists(cmdstanr::cmdstan_default_install_path())) diff --git a/tests/testthat/test-brms.R b/tests/testthat/test-brms.R index 14360ba73..2c5cae012 100644 --- a/tests/testthat/test-brms.R +++ b/tests/testthat/test-brms.R @@ -38,7 +38,7 @@ test_that("brms", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("brms_1") @@ -57,7 +57,7 @@ test_that("brms", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("brms_mv_2") @@ -81,7 +81,7 @@ test_that("brms", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("brms_2") diff --git a/tests/testthat/test-ci.R b/tests/testthat/test-ci.R index fd9884967..2fdf1d3ca 100644 --- a/tests/testthat/test-ci.R +++ b/tests/testthat/test-ci.R @@ -32,7 +32,7 @@ test_that("ci", { test_that("ci", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("brms") m <- insight::download_model("stanreg_merMod_5") @@ -49,7 +49,7 @@ test_that("ci", { test_that("rope", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("brms") m <- insight::download_model("brms_zi_3") diff --git a/tests/testthat/test-describe_posterior.R b/tests/testthat/test-describe_posterior.R index db265a679..de9db998e 100644 --- a/tests/testthat/test-describe_posterior.R +++ b/tests/testthat/test-describe_posterior.R @@ -3,7 +3,7 @@ test_that("describe_posterior", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") skip_on_os("linux") @@ -113,7 +113,7 @@ test_that("describe_posterior", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") set.seed(333) @@ -250,7 +250,7 @@ test_that("describe_posterior", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("stanreg_merMod_5") @@ -267,7 +267,7 @@ test_that("describe_posterior", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("brms_zi_3") @@ -286,7 +286,7 @@ test_that("describe_posterior w/ BF+SI", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") x <- insight::download_model("stanreg_lm_1") @@ -322,7 +322,7 @@ test_that("describe_posterior: BayesFactor", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") set.seed(123) diff --git a/tests/testthat/test-describe_prior.R b/tests/testthat/test-describe_prior.R index 8ba26521f..011f251d9 100644 --- a/tests/testthat/test-describe_prior.R +++ b/tests/testthat/test-describe_prior.R @@ -2,7 +2,7 @@ test_that("describe_prior", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") skip_on_os("linux") diff --git a/tests/testthat/test-hdi.R b/tests/testthat/test-hdi.R index 84785b364..367f2e179 100644 --- a/tests/testthat/test-hdi.R +++ b/tests/testthat/test-hdi.R @@ -3,7 +3,7 @@ test_that("hdi", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") expect_equal(hdi(distribution_normal(1000), ci = 0.90)$CI_low[1], -1.64, tolerance = 0.02) @@ -25,7 +25,7 @@ test_that("ci", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("stanreg_merMod_5") @@ -43,7 +43,7 @@ test_that("rope", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("brms_zi_3") @@ -61,7 +61,7 @@ test_that("ci - BayesFactor", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") mod_bf <- proportionBF(y = 15, N = 25, p = 0.5) diff --git a/tests/testthat/test-point_estimate.R b/tests/testthat/test-point_estimate.R index 873e35ee2..769ee71d5 100644 --- a/tests/testthat/test-point_estimate.R +++ b/tests/testthat/test-point_estimate.R @@ -2,7 +2,7 @@ test_that("point_estimate: stanreg", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") m <- insight::download_model("stanreg_merMod_5") p <- insight::get_parameters(m, effects = "all") @@ -18,7 +18,7 @@ test_that("point_estimate: brms", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") m <- insight::download_model("brms_zi_3") p <- insight::get_parameters(m, effects = "all", component = "all") diff --git a/tests/testthat/test-print.R b/tests/testthat/test-print.R index d353c6601..653814629 100644 --- a/tests/testthat/test-print.R +++ b/tests/testthat/test-print.R @@ -2,7 +2,7 @@ test_that("print.describe_posterior", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") m <- insight::download_model("brms_zi_3") expect_snapshot(describe_posterior(m, verbose = FALSE), variant = "windows") diff --git a/tests/testthat/test-rstanarm.R b/tests/testthat/test-rstanarm.R index 75546cc27..868303a6b 100644 --- a/tests/testthat/test-rstanarm.R +++ b/tests/testthat/test-rstanarm.R @@ -2,7 +2,7 @@ test_that("rstanarm", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("stanreg_lm_1") @@ -50,7 +50,7 @@ test_that("rstanarm", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("stanreg_glm_3") @@ -69,7 +69,7 @@ test_that("rstanarm", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("stanreg_merMod_3") @@ -89,7 +89,7 @@ test_that("rstanarm", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("stanmvreg_1") @@ -109,7 +109,7 @@ test_that("rstanarm", { skip_on_cran() skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") set.seed(333) model <- insight::download_model("stanmvreg_1") diff --git a/tests/testthat/test-spi.R b/tests/testthat/test-spi.R index 41d377106..f6b86dad7 100644 --- a/tests/testthat/test-spi.R +++ b/tests/testthat/test-spi.R @@ -3,7 +3,7 @@ test_that("spi", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") expect_equal(spi(distribution_normal(1000), ci = 0.90)$CI_low[1], -1.65, tolerance = 0.02) @@ -25,7 +25,7 @@ test_that("ci", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("stanreg_merMod_5") @@ -42,7 +42,7 @@ test_that("spi brms", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") m <- insight::download_model("brms_zi_3") @@ -60,7 +60,7 @@ test_that("ci - BayesFactor", { skip_if_offline() skip_if_not_or_load_if_installed("rstanarm") skip_if_not_or_load_if_installed("brms") - skip_if_not_or_load_if_installed("httr") + skip_if_not_or_load_if_installed("httr2") skip_if_not_or_load_if_installed("BayesFactor") mod_bf <- proportionBF(y = 15, N = 25, p = 0.5) diff --git a/vignettes/mediation.Rmd b/vignettes/mediation.Rmd index 70bc70a9c..ae9eb5d0f 100644 --- a/vignettes/mediation.Rmd +++ b/vignettes/mediation.Rmd @@ -1,6 +1,6 @@ --- title: "Mediation Analysis using Bayesian Regression Models" -output: +output: rmarkdown::html_vignette: toc: true fig_width: 10.08 @@ -10,7 +10,7 @@ vignette: > \usepackage[utf8]{inputenc} %\VignetteIndexEntry{Mediation Analysis using Bayesian Regression Models} %\VignetteEngine{knitr::rmarkdown} -editor_options: +editor_options: chunk_output_type: console bibliography: bibliography.bib csl: apa.csl @@ -31,7 +31,7 @@ options(width = 80) if (!requireNamespace("mediation", quietly = TRUE) || !requireNamespace("curl", quietly = TRUE) || - !requireNamespace("httr", quietly = TRUE) || + !requireNamespace("httr2", quietly = TRUE) || !requireNamespace("lavaan", quietly = TRUE) || !requireNamespace("brms", quietly = TRUE) || !requireNamespace("rstanarm", quietly = TRUE) ||