tests/testthat/test-eval_with.R

test_that("eval_with works in simple cases", {

  data <- data.frame(x = 1:3, a = LETTERS[1:3], stringsAsFactors = FALSE)

  expect_equal(eval_with(x * 3, data), data$x * 3)
  expect_equal(eval_with(a == "b", data), data$a == "b")
  tmp <- 5
  expect_equal(eval_with(x * tmp, data), data$x * tmp)
  expect_equal(eval_with("x * tmp", data), data$x * tmp)
  string <- "x * tmp"
  expect_equal(eval_with(string, data), data$x * tmp)
  expect_equal(eval_with(a[1:2], data), data$a[1:2])
  expect_error(eval_with(a[1], data))

})

Try the glmGamPoi package in your browser

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

glmGamPoi documentation built on Nov. 8, 2020, 7:14 p.m.