tests/testthat/test-cor_clusters.R

testthat::test_that("`cor_clusters()` works", {

  vi <- vi[1:1000, ]
  predictors <- vi_predictors[1:15]

  df <- cor_clusters(
    df = vi,
    predictors = predictors
    )

  testthat::expect_true(
    is.data.frame(df)
    )

  testthat::expect_true(
    all(c("predictor", "cluster") %in% colnames(df))
  )

  testthat::expect_true(
    class(df$predictor) == "character"
  )


  testthat::expect_true(
    class(df$cluster) == "integer"
  )

  testthat::expect_true(
    max(df$cluster) < nrow(df)
  )


})

Try the collinear package in your browser

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

collinear documentation built on April 12, 2025, 1:36 a.m.