11 Testing a package
In package development, it is good practice to test any code to make sure it does what it suppose to. Tests are written to be automatically executed and fails when results are not what are expected. When we have data we could add tests that make sure data is in the expected format before pushing our package to users.
The teststhat package contains a framework for unit testing in R. The R Packages book (Wickham, Çetinkaya-Rundel, and Grolemund 2023) provides an overview over testing in package development.