tests/testthat/test-TomekLinks.r

context("Tests for TomekLinks filter")

test_that("error is thrown when there are more than two classes", {
      expect_error(TomekLinks(Species~., data =iris))
})

test_that("the filter works when there are two classes", {
      skip_on_cran()
      twoClassIris <- iris[1:100,]
      twoClassIris$Species <- factor(twoClassIris$Species)
      out <- TomekLinks(twoClassIris)
      expect_is(out,"filter")
      expect_equal(twoClassIris[setdiff(1:100,out$remIdx),],out$cleanData)
})

Try the NoiseFiltersR package in your browser

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

NoiseFiltersR documentation built on May 29, 2017, 3:12 p.m.