Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Apr 30, 2024
1 parent 5446137 commit e9779a8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/testthat/test-coxme.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ test_that("get_data works with mf", {
{
data(eortc, package = "coxme")
Surv <- survival::Surv
d <- as.data.frame(eortc)
mcoxme <- coxme::coxme(Surv(y, uncens) ~ trt + (1 | center), data = d)
d2 <- as.data.frame(eortc)
mcoxme <- coxme::coxme(Surv(y, uncens) ~ trt + (1 | center), data = d2)

# environment
out <- get_data(mcoxme)
Expand All @@ -205,6 +205,19 @@ test_that("get_data works with mf", {
out <- get_data(mcoxme, source = "mf")
expect_identical(nrow(out), 2323L)
expect_named(out, c("y", "uncens", "center", "trt"))

d2 <- as.data.frame(eortc)
d2$surv <- survival::Surv(d2$y, d2$uncens)
mcoxme <- coxme::coxme(surv ~ trt + (1 | center), data = d2)

# environment
out <- get_data(mcoxme)
expect_identical(nrow(out), 2323L)
expect_named(out, c("surv", "trt", "center"))
# modelframe
out <- get_data(mcoxme, source = "mf")
expect_identical(nrow(out), 2323L)
expect_named(out, c("y", "uncens", "center", "trt", "surv"))
}
)
})

0 comments on commit e9779a8

Please sign in to comment.