tests/testthat/test_cases.R

library(clustRcompaR)
context("Basic Functionality")

d <- inaugural_addresses
d <- dplyr::mutate(d, century = ifelse(Year < 1800, "17th",
                                       ifelse(Year >= 1800 & Year < 1900, "18th",
                                              ifelse(Year >= 1900 & Year < 2000, "19th", "20th"))))

three_clusters <- cluster(d, n_clusters = 3)

#saveRDS(object = three_clusters, file = "three_cluster.rds")

test_that("Clustering works correctly", {
  expect_known_output(three_clusters, "three_cluster.rds")
})

Try the clustRcompaR package in your browser

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

clustRcompaR documentation built on May 1, 2019, 11:16 p.m.