Metaprogramming in R
While reworking the DCE Simulation package for my Thesis, I’ve discovered one more interesting topic to speak about. We have already seen how to create a package, write documentation and implement OOP in R. Now it comes the time of Metaprogramming. But don’t be afraid of this unfamiliar term, we are going to see that the concepts behind it are fairly simple.
Most of the materials presented are adopted from this mazing book about advanced R. My task here is mostly the vulgarisation of the material.
Tests in R
Following the previous post about the package creation in R we are going to dive into some details about how to work with packages. The first thing of interest for us is the possibility to perform tests on the package’s contents in order to control the result. Such possibility greatly facilitates the workflow while creating a package and ensures its functionality.
What is testthat?
Focusing our attention on the devtools meta-package’s contents we encounter rather quickly a great number of tools to test packages.
One of the key element here is the testthat package, which has a number of functions to perform tests.
Among the advantages listed on the project’s official webpage we discover testthat is, as it:
Creating packages with R
Some days ago I’ve started to revise the code of one particular R package I’m using in my thesis work. This is a particular package developed by our team and implemented by one of my friends - Antoine Dubois. The main idea behind the implemented toolset is the simulation of individual behaviour under the most popular behavioural models. The final product should simplify the model pen-testing and performance evaluation tasks for economists and experimentalists.