tests/testthat/test_titanic.R

devtools::load_all()

head(titanic)

m <- "Survived ~ Age + Sex + Age:Sex"
testthat::expect_no_error({
  fit <- pls(m, data = titanic, ordered = c("Survived", "Sex"),
           bootstrap = TRUE, boot.parallel = "multicore",
           boot.ncores = 4, boot.R = 50)

  pls_predict(fit, benchmark = c("acc"))
})


testthat::expect_no_error({
  fit <- pls(m, data = titanic, ordered = c("Survived"),
             bootstrap = TRUE, boot.parallel = "multicore",
             boot.ncores = 4, boot.R = 50, missing = "kNN", knn.k = 10)
})

testthat::expect_no_error({
  fit <- pls(m, data = titanic, ordered = c("Survived"),
             bootstrap = FALSE, missing = "mean")
})

testthat::expect_error(pls("Survived ~ Embarked", data = titanic),
                       regexp = "Please recode .*")

Try the plssem package in your browser

Any scripts or data that you put into this service are public.

plssem documentation built on Sept. 26, 2026, 5:06 p.m.