tests/testthat/test-cor.R

matrix <- matrix(c(1:9), nrow=3, ncol=3)

test_that("select_cor", {
  expect_equal(select_cor(x=matrix, cor=TRUE), cor(matrix))
  expect_equal(select_cor(x=matrix, cor=FALSE), cov(matrix))
  expect_error(select_cor(x=matrix, cor=""))  
})

test_that("wrong_cor", {
  expect_error(wrong_cor(cor="Test"))
})

Try the prinvars package in your browser

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

prinvars documentation built on Jan. 9, 2023, 5:12 p.m.