tests/testthat/test-jnt_cat.R

library(testthat)
library(JNplots)

# Test whether the expected intervals are found (significant interaction)
test_that("expected JN interval is found", {
  z <- jnt_cat(X='svl', Y='hl', m='species', data=microlophus, plot.full = T,
               xlab='log(SVL)', ylab='log(head length)')
  expect_equal(as.numeric(z$`lower limit in X`), 4.132542, tolerance = 0.0001)
  expect_equal(as.numeric(z$`upper limit in X`), 4.325789, tolerance = 0.0001)
})

# Test whether the output is a list
test_that("jnt_cat() returns a list", {
  z <- jnt_cat(X='svl', Y='hh', m='species', data=microlophus, plot.full = F,
               xlab='log(SVL)', ylab='log(head height)')
  expect_type(z, "list")
})

Try the JNplots package in your browser

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

JNplots documentation built on Nov. 24, 2023, 5:08 p.m.