Skip to content

Commit b5befaa

Browse files
committed
extensions to tests + revisions to hopefully fix failure on macos
1 parent 78d7e9c commit b5befaa

7 files changed

Lines changed: 1331 additions & 12 deletions

R/complr-methods.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ mean.complr <- function(x,
108108
#' x <- complr(data = mcompd, sbp = sbp,
109109
#' parts = c("TST", "WAKE", "MVPA", "LPA", "SB"),
110110
#' idvar = "ID")
111-
#' multilevelcoda:::var.complr(x)
111+
#' ## ensure dispatch to the s3 generic var function
112+
#' ## defined in the compositions package
113+
#' compositions::var(x)
112114
#' @export
113115
var.complr <- function(x,
114116
weight = c("equal", "proportional"),

man/var.complr.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-bsubmargins.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ suppressWarnings(
4545
)
4646
foreach::registerDoSEQ()
4747

48-
x <- bsubmargin(object = m, base = psub, delta = 1:2)
48+
x <- bsubmargin(object = m, base = psub, delta = c(1, 5))
4949

5050
stress_result <- function(x, part) {
5151
x[[part]][["Stress"]]
@@ -80,7 +80,7 @@ expect_pairwise_direction_and_ci <- function(pair) {
8080
pair_result <- bsubmargin(
8181
object = fit_pair,
8282
base = build.base(pair),
83-
delta = 1:2
83+
delta = c(1, 5)
8484
)
8585

8686
to_first <- pair_result[[pair[1]]][["Stress"]]
@@ -105,8 +105,8 @@ expect_pairwise_direction_and_ci <- function(pair) {
105105
}
106106

107107
test_that("bsubmargin errors for missing required arguments", {
108-
expect_error(bsubmargin(base = psub, delta = 2))
109-
expect_error(bsubmargin(object = m, delta = 2))
108+
expect_error(bsubmargin(base = psub, delta = 5))
109+
expect_error(bsubmargin(object = m, delta = 5))
110110
expect_error(bsubmargin(object = m, base = psub))
111111
})
112112

@@ -130,7 +130,7 @@ test_that("bsubmargin returns the expected nested result structure", {
130130
expect_true(all(tmp$Level == "between"))
131131
expect_true(all(tmp$Reference == "clustermean"))
132132
expect_setequal(unique(tmp$From), setdiff(parts, part))
133-
expect_setequal(unique(tmp$Delta), c(-2, -1, 1, 2))
133+
expect_setequal(unique(tmp$Delta), c(-5, -1, 1, 5))
134134
expect_type(tmp$Estimate, "double")
135135
expect_type(tmp$Est.Error, "double")
136136
expect_type(tmp$CI_low, "double")
@@ -145,9 +145,9 @@ test_that("bsubmargin returns estimates in a sensible range", {
145145
for (part in parts) {
146146
tmp <- stress_result(x, part)
147147

148-
expect_true(all(abs(tmp$Estimate) <= 0.5))
149-
expect_true(all(abs(tmp$CI_low) <= 1))
150-
expect_true(all(abs(tmp$CI_high) <= 1))
148+
expect_true(all(abs(tmp$Estimate) <= 1))
149+
expect_true(all(abs(tmp$CI_low) <= 5))
150+
expect_true(all(abs(tmp$CI_high) <= 5))
151151
}
152152
})
153153

@@ -156,7 +156,7 @@ test_that("bsubmargin estimates grow in magnitude from 1 to 2 minutes", {
156156
tmp <- stress_result(x, part)
157157
magnitude_check <- tmp[
158158
,
159-
.(smaller = abs(Estimate[abs(Delta) == 1]) < abs(Estimate[abs(Delta) == 2])),
159+
.(smaller = abs(Estimate[abs(Delta) == 1]) < abs(Estimate[abs(Delta) == 5])),
160160
by = From
161161
]
162162

0 commit comments

Comments
 (0)