tests/testthat/test_center_interval.R

context("center_interval")
library(testthat)
library(hmi)

#test_check("hmi")

test_that("intervals are centered correctly", {
  expect_equal(center_interval(c("100;100", "0;100", "150;200")), c(100, 50, 175))
  expect_equal(center_interval(c("100;100", "0;Inf", "150;200")), c(100, Inf, 175))
  expect_equal(center_interval(c("100;100", "0;Inf", "150;200"), inf2NA = TRUE), c(100, NA, 175))
  expect_equal(center_interval(c("100;100", "0;100", NA)), c(100, 50, NA))
})

Try the hmi package in your browser

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

hmi documentation built on Oct. 23, 2020, 7:31 p.m.