tests/testthat/test-countland_cluster.R

mat <- rbind(c(0.01,0.01,0.01),
             c(0.01,0.02,0.01),
             c(100,100,100))

test_that("function Cluster, returns correct values",{
  C <- new("countland")
  C@embedding <- mat
  C@verbose=TRUE
  C <- Cluster(C,n_clusters=2)
  C@cluster_labels

  expect_true(C@cluster_labels[1] == C@cluster_labels[2])
  expect_true(C@cluster_labels[1] != C@cluster_labels[3])
})

test_that("function PlotEigengap, returns plot object", {
  C <- new("countland")
  C@embedding <- mat
  C@cluster_labels <- c(1,1,2)
  expect_true(ggplot2::is.ggplot(PlotEmbedding(C)))
})

Try the countland package in your browser

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

countland documentation built on May 29, 2024, 7:13 a.m.