10
$\begingroup$

I often use Nose, Tox or Unittest when testing my python code, specially when it has to be integrated with other modules or other pieces of code. However, now that I've found myself using R more than python for ML modelling and development. I realized that I don't really test my R code (And more importantly I really don't know how to do it well). So my question is, what are good packages that allow you to test R code in a similar manner as Nose, Tox or Unittest do in Python. Additional references such as tutorials will be greatly appreciated as well.

Bonus points for packages in R similar to

  1. Hypothesis

    or

  2. Feature Forge

Related Talk:

Trey Causey: Testing for Data Scientists

$\endgroup$

2 Answers 2

7
$\begingroup$

Packages for unit testing and assertive testing that are actively maintained: Packages for unit testing

  1. testthat: more information on how to use you can find here or on github
  2. Runit: Cran page

Packages for assertions:

  1. assertthat: info on github

  2. assertive: Assertive has a lot of subpackages available in case you do not need all of them. check on cran

  3. assertr: info on github

  4. ensurer: info on github

  5. tester: info on github

It is a matter of preference what you want to use for assertions. Read this bioconductor page for more info on the difference between RUnit and testthat.

$\endgroup$
2
  • 1
    $\begingroup$ False. RUnit has a new maintainer. $\endgroup$ Commented Jan 3, 2016 at 0:39
  • 1
    $\begingroup$ @DirkEddelbuettel, adjusted based on your info. tnx $\endgroup$
    – phiver
    Commented Jan 3, 2016 at 8:13
1
$\begingroup$

For a testing package similar to Hypothesis and based on Haskell's quickcheck, there's the R package from Revolution Analytics called quickcheck.

$\endgroup$
1
  • $\begingroup$ it looks great, I will try it out. $\endgroup$
    – wacax
    Commented Jan 7, 2016 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.