tests/testthat/test-mass-mca.r

fit_mca <- MASS::mca(MASS::farms)

test_that("'mca' accessors have consistent dimensions", {
  expect_equal(ncol(get_rows(fit_mca)), ncol(get_cols(fit_mca)))
  expect_equal(ncol(get_rows(fit_mca)), length(recover_inertia(fit_mca)))
})

test_that("'mca' has specified distribution of inertia", {
  expect_type(recover_conference(fit_mca), "double")
  expect_vector(recover_conference(fit_mca), size = 2L)
})

test_that("'mca' augmentations are consistent with '.element' column", {
  expect_equal(".element" %in% names(recover_aug_rows(fit_mca)),
               ".element" %in% names(recover_aug_cols(fit_mca)))
})

test_that("`as_tbl_ord()` coerces 'mca' objects", {
  expect_true(valid_tbl_ord(as_tbl_ord(fit_mca)))
})

Try the ordr package in your browser

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

ordr documentation built on Oct. 21, 2022, 1:07 a.m.