Most (all?) testing packages in R are built around the idea of testing a value at a particular moment in time e.g. “Check that a == 2
right now”.
R
I’m still experimenting with function body modification, and I’ve downscaled my ambitions and thought about what a type check helper should look like.
I’m still experimenting with function body modification, and I’ve downscaled my ambitions and thought about what a type check helper should look like.
The prior experiment on generating automatic runtime tests and the ensurer
package used different methods of trying to wrap the original function so that it could be augmented with tests. What other ways are possible/sensible?
This post is mainly scratching an itch to learn about some function internals. I want to work out a way to have R generate all the type checks for a given function given some shorter definition.
A function consists of 3 things:
My prior post on tidyverse split-apply-combined ended with me favouring split + map_dfr
as a replacement for group_by + do
. In prior posts I saw:
Some test plots in order to get borders and font-sizes correct for large (A0) plan printing from ggplot
.
Last week I searched for a replacement for group_by + do
, and this ended with split + map_dfr
being my favourite alternative. Conceptually it was the most compact representation of the idea (just 2 commands) and avoided a the extra work that seemed necessary to nest a data.frame and operate on the nested data.
My prior post on tidyverse split-apply-combined ended with me favouring split + map_dfr
as a replacement for group_by + do
.
In subsequent posts I looked at the runtime of the split function and the idioscrasies of the split function and saw the following for the Base R split()
function: