context("plot principal component analysis")
test_that("test error", {
expect_silent(plot_prcomp(iris))
expect_error(plot_prcomp(airquality))
})
test_that("test return object", {
plot_list <- plot_prcomp(iris, variance_cap = 1, nrow = 2L, ncol = 2L)
expect_is(plot_list, "list")
expect_equal(names(plot_list), c("page_0", "page_1", "page_2"))
expect_true(all(vapply(plot_list, is.ggplot, TRUE)))
})
test_that("test zero variance", {
expect_warning(plot_prcomp(subset(iris, Species == "setosa")))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.