tests/testthat/test-response_var.R

test_that("can extract response from linear model", {
  mod <- lm(mpg ~ wt, data = mtcars)
  expect_identical(response_var(mod), quote(mpg))
})

test_that("can extract response from loess model", {
  mod <- loess(mpg ~ wt, data = mtcars)
  expect_identical(response_var(mod), quote(mpg))
})

Try the modelr package in your browser

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

modelr documentation built on March 31, 2023, 5:20 p.m.