tests/testthat/test-cor_to_cov.R

test_that("cor_to_cov", {
  cor <- cor(iris[1:4])
  expect_error(cor_to_cov(cor))

  expect_error(cor_to_cov(as.matrix(rnorm(5))))

  expect_error(cor_to_cov(cor, sd = sapply(iris[1:3], sd)))
})

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.