tests/testthat/test_kaisers_index.R

context("kaisers_index")

set.seed(123)
x <- matrix(rnorm(200*3), ncol = 10)

x %>%
  horns_curve() %>%
  factor_analysis(x, hc_points = .) %>%
  factor_analysis_results(fa_loadings_rotated)


test_that("kaisers_index provides proper messages and warnings", {

  expect_that(kaisers_index(letters), throws_error())

})

test_that("kaisers_index output is correct object and dimensions", {

  expect_true(kaisers_index(x) %>% is.atomic)
  expect_true(kaisers_index(x) %>% is.numeric)
  expect_equal(kaisers_index(x) %>% length(), 1)

})

test_that("kaisers_index computes appropriately", {

  expect_equal(kaisers_index(x) %>% round(3), 0.397)

})

Try the anomalyDetection package in your browser

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

anomalyDetection documentation built on March 18, 2018, 1:21 p.m.