R is a statistics programming language. Part of R is the use of Packages, which themselves are written in the R language. Programming best practice includes the use of unit-testing to test the functions within these packages while they are being written and when they are used.
I am aware of a few packages for unit testing within R, these being
Unit testing seems to be more or less a solved problem, so all three packages will likely be adequate for your needs. There are subtle differences between them though:
RUnit is based on xunit, and as such is easy to understand if you've used any versions of it from other languages.
svUnit uses the same tests as RUnit, but includes a GUI to help with interactive use.
testthat isn't compatible with either, but includes much the same features and can check to only execute tests on files that haven't changed, which is useful for testing large projects.
Several years later...
svUnit still don't have checks for messages and warnings, nor test caching, and don't seem to be under much development, so
testthat should be your first choice for new projects. You can convert
RUnit tests to
testthat tests using my