Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 24, 2024
1 parent c1f02c2 commit 2733d68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions R/cor_test_bayes.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@

if (x == y) {
# Avoid error in the case of perfect correlation
rez <- BayesFactor::correlationBF(stats::rnorm(1000), stats::rnorm(1000), rscale = bayesian_prior)
rez <- suppressWarnings(BayesFactor::correlationBF(
stats::rnorm(1000),
stats::rnorm(1000),
rscale = bayesian_prior
))
params <- parameters::model_parameters(
rez,
dispersion = FALSE,
Expand All @@ -79,7 +83,11 @@
if ("ROPE_Percentage" %in% names(params)) params$ROPE_Percentage <- 0
if ("BF" %in% names(params)) params$BF <- Inf
} else {
rez <- BayesFactor::correlationBF(var_x, var_y, rscale = bayesian_prior)
rez <- suppressWarnings(BayesFactor::correlationBF(
var_x,
var_y,
rscale = bayesian_prior
))
params <- parameters::model_parameters(
rez,
dispersion = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-correlation.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ test_that("specific types", {
y = as.ordered(sample(letters[1:5], 20, TRUE))
)

correlation(data, method = "polychoric")
expect_warning(correlation(data, method = "polychoric"), regex = "It seems like")
})

test_that("correlation doesn't fail when BFs are NA", {
Expand Down

0 comments on commit 2733d68

Please sign in to comment.