montrealvur.blogg.se

Building an r package
Building an r package











building an r package

Now add another testthat::test_that block called "default values". You should see output like: Loading demopckg You can test more values than these, but we'll start with just these two.Īfter you save this file, run devtools::test().

building an r package

We're going to check two expectations, that we'll get the error message "p cannot be less than 0" if p = -1, and that we'll get the error message "p cannot be greater than 1" id p = 2.

building an r package

The first set we're going to make checks if we get the error messages we expect, so we've called it "errors". The test_that function checks a groups of expectataions. The context function lets you know what function you're testing when you run all the unit tests in a package.

  • B.2.2 Enable version control in RStudio.












  • Building an r package