tests/testthat/test-treeConversionDendrogram.R

context("tree conversion dendrogram")


test_that("as.Node.dendrogram", {
  hc <- hclust(dist(USArrests), "ave")
  dend1 <- as.dendrogram(hc)
  root <- as.Node(dend1)
  expect_equal(root$totalCount, 99)
  expect_true(root$isBinary)
})


test_that("as.dendrogram.Node", {
  data(acme)
  acmed <- as.dendrogram(acme)
  expect_equal(class(acmed), "dendrogram")
  expect_equal(nobs(acmed), acme$leafCount)
  expect_equal(attr(acmed, "height"), 100)
})

Try the data.tree package in your browser

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

data.tree documentation built on Nov. 13, 2023, 1:08 a.m.