Skip to content

Commit

Permalink
spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
cbhurley committed Aug 29, 2024
1 parent d751bf9 commit 07febd4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 63 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Authors@R:
person(given = "Catherine", family = "Hurley", email = "[email protected]", role = c("aut", "cre")))
Description: We provide a tidy data structure and visualisations for multiple or grouped variable correlations,
general association measures scagnostics and other pairwise scores suitable for numerical, ordinal and nominal variables.
Supported measures include distance correlation, maximal information, ace correlation, Kendall's tau, and polychoric corrrelation.
Supported measures include distance correlation, maximal information, ace correlation, Kendall's tau, and polychoric correlation.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
107 changes: 50 additions & 57 deletions tests/testthat/test-pair_methods.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


test_that("pair cor", {
p <- pair_cor(iris[c(1,2,51,52,53),])
expect_s3_class(p, "pairwise")
Expand All @@ -13,28 +12,25 @@ test_that("pair cancor", {
})

test_that("pair dcor", {
if (requireNamespace("energy", quietly = TRUE)){
skip_if_not(requireNamespace("energy", quietly = TRUE), message = "Package energy not available.")
p <- pair_dcor(iris[1:4,])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(6L,6L))
}
})


test_that("pair mine", {
if (requireNamespace("minerva", quietly = TRUE)){
p <- pair_mine(iris[c(1,2,51,52,53),])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(6L,6L))
}
skip_if_not(requireNamespace("minerva", quietly = TRUE), message = "Package minerva not available.")
p <- pair_mine(iris[c(1,2,51,52,53),])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(6L,6L))
})

test_that("pair nmi", {
if (requireNamespace("linkspotter", quietly = TRUE)){
p <- pair_nmi(iris[1:4,])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(10L,6L))
}
skip_if_not(requireNamespace("linkspotter", quietly = TRUE), message = "Package linkspotter not available.")
p <- pair_nmi(iris[1:4,])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(10L,6L))
})

test_that("pair polychor", {
Expand All @@ -54,36 +50,36 @@ test_that("pair polyserial", {
})

test_that("pair tau", {
if (requireNamespace("DescTools", quietly = TRUE)){
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_tauB(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauA(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauC(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauW(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
}
skip_if_not(requireNamespace("DescTools", quietly = TRUE), message = "Package DescTools not available.")
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
iris1 <- droplevels(iris1)
p <- pair_tauB(iris1)
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauA(iris1)
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauC(iris1)
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
p <- pair_tauW(iris1)
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
})


test_that("pair uncertainty", {
if (requireNamespace("DescTools", quietly = TRUE)){
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_uncertainty(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
}
skip_if_not(requireNamespace("DescTools", quietly = TRUE), message = "Package DescTools not available.")
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_uncertainty(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
})

test_that("pair gkTau", {
skip_if_not(requireNamespace("DescTools", quietly = TRUE), message = "Package DescTools not available.")
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_gkTau(droplevels(iris1))
Expand All @@ -93,37 +89,34 @@ test_that("pair gkTau", {


test_that("pair gkGamma", {
if (requireNamespace("DescTools", quietly = TRUE)){
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_gkGamma(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
}
skip_if_not(requireNamespace("DescTools", quietly = TRUE), message = "Package DescTools not available.")
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_gkGamma(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
})

test_that("pair chi", {
if (requireNamespace("DescTools", quietly = TRUE)){
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_chi(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
}
skip_if_not(requireNamespace("DescTools", quietly = TRUE), message = "Package DescTools not available.")
iris1 <- iris[c(1,2,53,55),]
iris1$Sepal.Length <- cut(iris1$Sepal.Length,2)
p <- pair_chi(droplevels(iris1))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(1L,6L))
})

test_that("pair ace", {
if (requireNamespace("acepack", quietly = TRUE)){
p <- pair_ace(iris[c(1,2,53,55),])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(10L,6L))
}
skip_if_not(requireNamespace("acepack", quietly = TRUE), message = "Package acepack not available.")
p <- pair_ace(iris[c(1,2,53,55),])
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(10L,6L))
})


test_that("pair multi", {
p <- pairwise_multi(iris)
p <- pairwise_multi(iris, scores=c("pair_cor", "pair_cancor"))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(54L,6L))
expect_identical(dim(p), c(22L,6L))
})

9 changes: 4 additions & 5 deletions tests/testthat/test-pair_scagnostics.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

test_that("pair scagnostics", {
if (requireNamespace("scagnostics", quietly = TRUE)){
p <- pair_scagnostics(iris[c(1,2,53,55),], c("Clumpy", "Striated"))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(12L,6L))
}
skip_if_not(requireNamespace("scagnostics", quietly = TRUE), message = "Package scagnostics not available.")
p <- pair_scagnostics(iris[c(1,2,53,55),], c("Clumpy", "Striated"))
expect_s3_class(p, "pairwise")
expect_identical(dim(p), c(12L,6L))
})

0 comments on commit 07febd4

Please sign in to comment.