tests/testthat/test-list.R

fitted_rf <- function(...) tidypredict_fit(parse_model(...))

skip_if_not_installed("randomForest")

test_that("Supports parsed models in list objects", {
  expect_equal(
    class(fitted_rf(lm(mpg ~ wt, data = mtcars)))[1],
    "call"
  )
  expect_equal(
    length(fitted_rf(
      randomForest::randomForest(Species ~ ., data = iris)
    )),
    500
  )
})

Try the tidypredict package in your browser

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

tidypredict documentation built on Jan. 22, 2023, 1:41 a.m.