context("Summarize results")
test_that("Summarize PCA", {
data(decathlon, package = "FactoMineR")
res_pca1 <- FactoMineR::PCA(decathlon, scale.unit = TRUE,
ind.sup = 1:5, quanti.sup = 11:12,
quali.sup = 13, graph = FALSE)
select = c("individuals", "sup_individuals", "variables",
"quantitative", "qualitative")
ncol <- c(10, 7, 9, 6, 10)
for (i in 1:5) {
sum <- summarize(res_pca1, select = select[i], rows = 1:2, columns = 1:3)
expect_is(sum, "data.frame", info = select[i])
expect_equal(nrow(sum),2, info = select[i])
expect_equal(ncol(sum), ncol[i], info = select[i])
}
expect_error(summarize(res_pca1, select = "X"))
res_pca2 <- FactoMineR::PCA(decathlon, scale.unit = TRUE, quanti.sup = 11:12,
quali.sup = 13, graph = FALSE)
expect_null(summarize(res_pca2, select = "sup_individuals"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.