tests/testthat/test-manifest-scaling.r

context("check scaling of factors in data frame")

test_that("check_manifest_scaling works for right scaling", {
  aux =  c(3, 4, 5, 1, 2, 5, 1)
  MV = iris[,aux]
  good_scaling = list(c("num", "num", "nom"),
                      c("raw", "raw"),
                      c("nom", "ord"))
  
  expect_that(check_manifest_scaling(MV, good_scaling), is_true())
  expect_that(get_metric(c("raw", "raw")), is_true())
  expect_that(get_metric(c("num", "raw")), is_true())
})

test_that("check_manifest_scaling throws errors", {  
  aux =  c(3, 4, 5, 1, 2, 5, 1)
  MV = iris[,aux]
  bad_scaling = list(c("num", "num", "ord"),
                     c("raw", "raw"),
                     c("ord", "ord"))
  
  expect_that(check_manifest_scaling(MV, bad_scaling), throws_error())
})

Try the plspm package in your browser

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

plspm documentation built on May 2, 2019, 7:05 a.m.