Unit testing in R

Yesterday I gave a short talk for the Sheffield R Users’ Group about unit testing in R. I shared some examples of tests I’ve used with rakeR and my thesis. In short, there are two things you should really be testing when working in R: Data analysis scripts (usually in data-raw/) Functions (usually in R/) Head over to the repo and follow the instructions there to get started with your own tests: https://philmikejones. [Read More]

Formal informal testing of research code

When writing research code I do test my code and results, but until recently I’ve only been doing this informally and not in any systematic way. I decided it was time to change my testing habits when I noticed I had recoded a variable incorrectly despite my informal tests suggesting nothing was wrong. When I went back and corrected this error this made a small, but noticeable, difference to my model. [Read More]