Skip to content

Commit

Permalink
Fix partial matching (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Sep 8, 2024
1 parent 5d2d0d5 commit bfcb801
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/cor_test_distance.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
CI_low = rez$CI_low,
CI_high = rez$CI_high,
t = rez$t,
df_error = rez$df,
df_error = rez$df_error,
p = rez$p,
Method = "Distance (Bias Corrected)",
stringsAsFactors = FALSE
Expand Down
2 changes: 1 addition & 1 deletion R/cor_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ cor_text <- function(x, show_ci = TRUE, show_statistic = TRUE, show_sig = TRUE,
out_text <- paste0(
out_text,
", t(",
insight::format_value(x$df, protect_integers = TRUE),
insight::format_value(x$df_error, protect_integers = TRUE),
") = ",
insight::format_value(x$t)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-cor_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("cor_test kendall", {
test_that("cor_test bayesian", {
skip_if_not_or_load_if_installed("BayesFactor")
out <- cor_test(iris, "Petal.Length", "Petal.Width", bayesian = TRUE)
expect_equal(out$r, 0.9591191, tolerance = 0.01)
expect_equal(out$rho, 0.9591191, tolerance = 0.01)

set.seed(123)
df_1 <- cor_test(iris, "Petal.Length", "Petal.Width", bayesian = TRUE)
Expand Down Expand Up @@ -121,7 +121,7 @@ test_that("cor_test percentage", {
test_that("cor_test shepherd", {
set.seed(333)
out <- cor_test(iris, "Petal.Length", "Petal.Width", method = "shepherd")
expect_equal(out$r, 0.94762, tolerance = 0.01)
expect_equal(out$rho, 0.94762, tolerance = 0.01)

skip_if_not_or_load_if_installed("BayesFactor")
set.seed(333)
Expand Down Expand Up @@ -164,7 +164,7 @@ test_that("cor_test gaussian", {
expect_equal(out$r, 0.87137, tolerance = 0.01)

out <- cor_test(iris, "Petal.Length", "Petal.Width", method = "gaussian", bayesian = TRUE)
expect_equal(out$r, 0.8620878, tolerance = 0.01)
expect_equal(out$rho, 0.8620878, tolerance = 0.01)
})


Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-cor_test_na_present.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("cor_test bayesian", {

set.seed(123)
out <- cor_test(ggplot2::msleep, "brainwt", "sleep_rem", bayesian = TRUE)
expect_equal(out$r, -0.1947696, tolerance = 0.01)
expect_equal(out$rho, -0.1947696, tolerance = 0.01)
})

test_that("cor_test tetrachoric", {
Expand Down Expand Up @@ -122,7 +122,7 @@ test_that("cor_test gaussian", {

skip_if_not_or_load_if_installed("BayesFactor")
out <- cor_test(ggplot2::msleep, "brainwt", "sleep_rem", method = "gaussian", bayesian = TRUE)
expect_equal(out$r, -0.3269572, tolerance = 0.01)
expect_equal(out$rho, -0.3269572, tolerance = 0.01)
})


Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-misc.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("cor_to_cov", {
cor <- cor(iris[1:4])
cov <- cov(iris[1:4])
cov2 <- cor_to_cov(cor, var = sapply(iris[1:4], var))
cov2 <- cor_to_cov(cor, variance = sapply(iris[1:4], var))
expect_equal(max(cov - cov2), 0, tolerance = 0.0001)
})

Expand Down

0 comments on commit bfcb801

Please sign in to comment.