tests/testthat/test-3-rpart.R

test_that("data_tree() returns the correct classes", {
  if (!require("rpart", quietly = TRUE)) skip("package rpart not available")

  fit <- rpart(Kyphosis ~ Age + Number + Start, method = "class", data = kyphosis)
  tdata <- dendro_data(fit)
  expect_s3_class(tdata, "dendro")
  expect_s3_class(segment(tdata), "data.frame")
  expect_s3_class(label(tdata), "data.frame")
  expect_s3_class(leaf_label(tdata), "data.frame")
})

Try the ggdendro package in your browser

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

ggdendro documentation built on May 29, 2024, 6:12 a.m.