tests/testthat/test-methods.R

test_that("as.matrix.correlation", {
  rez <- correlation(mtcars)
  m <- as.matrix(rez)
  expect_equal(dim(m), c(11, 11))
})

test_that("summary.correlation - target column", {
  skip_if_not_or_load_if_installed("ggplot2")
  expect_snapshot(summary(correlation(ggplot2::msleep), target = "t"))
  expect_snapshot(summary(correlation(ggplot2::msleep), target = "df_error"))
  expect_snapshot(summary(correlation(ggplot2::msleep), target = "p"))
  expect_error(summary(correlation(ggplot2::msleep), target = "not_a_column_name"))
})

Try the correlation package in your browser

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

correlation documentation built on April 6, 2023, 5:18 p.m.