tests/testthat/test-treeplot.R

test_that("treeplot returns a ggplot object for longitree", {
  data(ltreedata)

  result <- longitree(y ~ ., time = "time", random = "subject",
                         weight = 0.2, data = ltreedata, gamma = 1.5)

  p <- treeplot(result)
  expect_s3_class(p, "ggplot")
})

test_that("treeplot errors on invalid input", {
  expect_error(treeplot("not_a_tree"), "longitree or threetrees")
})

Try the longitree package in your browser

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

longitree documentation built on May 16, 2026, 5:06 p.m.