require(modellingTools, quietly = TRUE, warn.conflicts = FALSE)
data(iris)
context("Variable Clustering")
clust <- modellingTools::exploratory_cluster(iris)
variables_clustered <- modellingTools::variable_cluster(clust,2)
test_that("exploratory_cluster returns the correct object", {
expect_is(clust,"mtClust")
expect_length(clust,2)
expect_equal(sort(names(clust)),c("hclust","stab"))
})
test_that("variable_cluster returns the correct object", {
expect_is(variables_clustered,c("tbl_df","tbl","data.frame"))
expect_equal(nrow(variables_clustered),5)
expect_equal(ncol(variables_clustered),2)
expect_equal(sort(colnames(variables_clustered)),c("cluster","variable"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.