testBasic.R 693 B

12345678910111213141516171819202122
  1. context("Basic tests")
  2. test_that("Selection works on an extended iris",{
  3. set.seed(777)
  4. #Add some nonsense attributes to iris dataset by shuffling original attributes
  5. iris.extended<-data.frame(iris,apply(iris[,-5],2,sample))
  6. names(iris.extended)[6:9]<-paste("Nonsense",1:4,sep="")
  7. #Run Boruta on this data
  8. Boruta(Species~.,data=iris.extended)->Boruta.iris.extended
  9. #Nonsense attributes should be rejected
  10. expect_equal(
  11. getSelectedAttributes(Boruta.iris.extended),
  12. names(iris)[-5]
  13. )
  14. attStats(Boruta.iris.extended)->a
  15. expect_equal(sort(rownames(a)),sort(names(iris.extended)[-5]))
  16. getSelectedAttributes(Boruta.iris.extended)->a
  17. expect_equal(sort(a),sort(names(iris)[-5]))
  18. })