Skip to content

Commit e860d5b

Browse files
authored
{correlation} bug is causing {ggstatsplot} check failures Fixes #269 (#270)
1 parent e31942e commit e860d5b

12 files changed

+24
-14
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: correlation
33
Title: Methods for Correlation Analysis
4-
Version: 0.8.2.4
4+
Version: 0.8.3
55
Authors@R:
66
c(person(given = "Dominique",
77
family = "Makowski",

NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# correlation (development version)
1+
# correlation 0.8.3
22

33
## Breaking Changes
44

@@ -8,6 +8,8 @@
88

99
## Minor Changes
1010

11+
- Fixes breakages caused by updates to *parameters* package (#269).
12+
1113
- The visualization recipe (plots) for redundant correlation matrices was
1214
improved, so self-correlations will no longer be labelled and get a neutral
1315
color.

R/cor_smooth.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ is_positive_definite <- is.positive_definite
132132
is.positive_definite.matrix <- function(x, tol = 10^-12, ...) {
133133
eigens <- try(eigen(x), silent = TRUE)
134134

135-
# Sanity checks
135+
# validation checks
136136
if (inherits(eigens, as.character("try-error"))) {
137137
stop(insight::format_message(
138138
"There is something seriously wrong with the correlation matrix, as some of the eigen values are NA."

R/cor_test_bayes.R

+4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@
8989
rope_ci = 1,
9090
...
9191
)
92+
# validation check: do we have a BF column?
93+
if (is.null(params$BF)) {
94+
params$BF <- NA
95+
}
9296
}
9397

9498
# Rename coef

cran-comments.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
0 errors | 0 warnings | 0 notes
44

5+
- Fixes breakages caused by updates to *parameters* package.
6+
57
## revdepcheck results
68

79
We checked 8 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

tests/testthat/test-as.list.R

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
if (require("poorman", quietly = TRUE) && require("ggplot2", quietly = TRUE)) {
22
test_that("as.list", {
3-
skip_if(getRversion() < "3.6")
4-
53
# no groups
64
set.seed(123)
75
expect_snapshot(as.list(correlation(mtcars)))

tests/testthat/test-correlation.R

+10-1
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,18 @@ test_that("specific types", {
177177
correlation(data, method = "polychoric")
178178
})
179179

180+
test_that("correlation doesn't fail when BFs are NA", {
181+
skip_if_not_installed("BayesFactor")
182+
loadNamespace("BayesFactor")
183+
df <- ggplot2::msleep
184+
185+
set.seed(123)
186+
df_corr <- correlation(subset(df, vore == "carni"), bayesian = TRUE)
187+
expect_equal(nrow(df_corr), 15L)
188+
})
189+
180190
test_that("as.data.frame for correlation output", {
181191
skip_on_cran()
182-
skip_if(getRversion() < "3.6")
183192

184193
set.seed(123)
185194
expect_snapshot(as.data.frame(correlation(ggplot2::msleep)))

tests/testthat/test-display_print_dataframe.R

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if (require("gt") && packageVersion("insight") >= "0.12.0.1") {
44
test_that("display and print method works - markdown", {
55
skip_on_cran()
6-
skip_if(getRversion() < "3.6")
6+
77

88
expect_equal(
99
display(correlation(iris)),
@@ -29,7 +29,6 @@ if (require("gt") && packageVersion("insight") >= "0.12.0.1") {
2929
# display and print method works - HTML -----------------------------
3030

3131
test_that("display and print method works - HTML", {
32-
skip_if(getRversion() < "3.6")
3332
skip_on_cran()
3433

3534
expect_output(display(print(correlation(subset(mtcars, select = c("wt", "mpg"))), format = "html")))

tests/testthat/test-display_print_matrix.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if (require("testthat") && require("gt") && require("poorman")) {
33

44
test_that("display and print method works - markdown", {
55
skip_on_cran()
6-
skip_if(getRversion() < "3.6")
6+
77

88
expect_equal(
99
display(summary(correlation(iris))),
@@ -32,7 +32,7 @@ if (require("testthat") && require("gt") && require("poorman")) {
3232

3333
test_that("display and print method works - html", {
3434
skip_on_cran()
35-
skip_if(getRversion() < "3.6")
35+
3636

3737
expect_snapshot(print(summary(correlation(iris)), format = "html"), cran = FALSE)
3838
})

tests/testthat/test-methods.R

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_that("as.matrix.correlation", {
55
})
66

77
test_that("summary.correlation - target column", {
8-
skip_if(getRversion() < "3.6")
98
skip_if_not_installed("ggplot2")
109
expect_snapshot(summary(correlation(ggplot2::msleep), target = "t"))
1110
expect_snapshot(summary(correlation(ggplot2::msleep), target = "df_error"))

tests/testthat/test-renaming.R

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
test_that("renaming columns", {
2-
skip_if(getRversion() < "3.6")
3-
42
# should warn the user
53
expect_snapshot(correlation(anscombe,
64
select = c("x1", "x2"),

tests/testthat/test-selecting_variables.R

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
if (require("poorman")) {
44
test_that("selecting specific variables works", {
5-
skip_if(getRversion() < "3.6")
65
set.seed(123)
76
df1 <-
87
mtcars %>%

0 commit comments

Comments
 (0)