Skip to content

Commit

Permalink
{correlation} bug is causing {ggstatsplot} check failures Fixes #269
Browse files Browse the repository at this point in the history
 (#270)
  • Loading branch information
strengejacke authored Oct 7, 2022
1 parent e31942e commit e860d5b
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: correlation
Title: Methods for Correlation Analysis
Version: 0.8.2.4
Version: 0.8.3
Authors@R:
c(person(given = "Dominique",
family = "Makowski",
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# correlation (development version)
# correlation 0.8.3

## Breaking Changes

Expand All @@ -8,6 +8,8 @@

## Minor Changes

- Fixes breakages caused by updates to *parameters* package (#269).

- The visualization recipe (plots) for redundant correlation matrices was
improved, so self-correlations will no longer be labelled and get a neutral
color.
Expand Down
2 changes: 1 addition & 1 deletion R/cor_smooth.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ is_positive_definite <- is.positive_definite
is.positive_definite.matrix <- function(x, tol = 10^-12, ...) {
eigens <- try(eigen(x), silent = TRUE)

# Sanity checks
# validation checks
if (inherits(eigens, as.character("try-error"))) {
stop(insight::format_message(
"There is something seriously wrong with the correlation matrix, as some of the eigen values are NA."
Expand Down
4 changes: 4 additions & 0 deletions R/cor_test_bayes.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
rope_ci = 1,
...
)
# validation check: do we have a BF column?
if (is.null(params$BF)) {
params$BF <- NA
}
}

# Rename coef
Expand Down
2 changes: 2 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

0 errors | 0 warnings | 0 notes

- Fixes breakages caused by updates to *parameters* package.

## revdepcheck results

We checked 8 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-as.list.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
if (require("poorman", quietly = TRUE) && require("ggplot2", quietly = TRUE)) {
test_that("as.list", {
skip_if(getRversion() < "3.6")

# no groups
set.seed(123)
expect_snapshot(as.list(correlation(mtcars)))
Expand Down
11 changes: 10 additions & 1 deletion tests/testthat/test-correlation.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,18 @@ test_that("specific types", {
correlation(data, method = "polychoric")
})

test_that("correlation doesn't fail when BFs are NA", {
skip_if_not_installed("BayesFactor")
loadNamespace("BayesFactor")
df <- ggplot2::msleep

set.seed(123)
df_corr <- correlation(subset(df, vore == "carni"), bayesian = TRUE)
expect_equal(nrow(df_corr), 15L)
})

test_that("as.data.frame for correlation output", {
skip_on_cran()
skip_if(getRversion() < "3.6")

set.seed(123)
expect_snapshot(as.data.frame(correlation(ggplot2::msleep)))
Expand Down
3 changes: 1 addition & 2 deletions tests/testthat/test-display_print_dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if (require("gt") && packageVersion("insight") >= "0.12.0.1") {
test_that("display and print method works - markdown", {
skip_on_cran()
skip_if(getRversion() < "3.6")


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

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

expect_output(display(print(correlation(subset(mtcars, select = c("wt", "mpg"))), format = "html")))
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-display_print_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (require("testthat") && require("gt") && require("poorman")) {

test_that("display and print method works - markdown", {
skip_on_cran()
skip_if(getRversion() < "3.6")


expect_equal(
display(summary(correlation(iris))),
Expand Down Expand Up @@ -32,7 +32,7 @@ if (require("testthat") && require("gt") && require("poorman")) {

test_that("display and print method works - html", {
skip_on_cran()
skip_if(getRversion() < "3.6")


expect_snapshot(print(summary(correlation(iris)), format = "html"), cran = FALSE)
})
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ test_that("as.matrix.correlation", {
})

test_that("summary.correlation - target column", {
skip_if(getRversion() < "3.6")
skip_if_not_installed("ggplot2")
expect_snapshot(summary(correlation(ggplot2::msleep), target = "t"))
expect_snapshot(summary(correlation(ggplot2::msleep), target = "df_error"))
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-renaming.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
test_that("renaming columns", {
skip_if(getRversion() < "3.6")

# should warn the user
expect_snapshot(correlation(anscombe,
select = c("x1", "x2"),
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-selecting_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

if (require("poorman")) {
test_that("selecting specific variables works", {
skip_if(getRversion() < "3.6")
set.seed(123)
df1 <-
mtcars %>%
Expand Down

0 comments on commit e860d5b

Please sign in to comment.