Substantial changes to R-C++ interface mechanism in R package

Move to using R "Reference Classes". This was necessary to allow R-side contexts
to be stored to prevent them being garbage collected. But potentially has other
benefits too.
When rendering a stencil remove previous `ref` directive renderings