Skip to content
Prev 13 / 117 Next

Hacking on the ChainLadder package?

On 10/21/2009 08:56 AM, Ben wrote:
It's not actually compilation. It just sort of organize the files, 
archive them, ... there is currently no compilation in byte code or 
anything.
Then you want to have a look at ?assignInNamespace or ?sys.source (untested)

sys.source( "Triangle.R", env = asNamespace( "ChainLadder" ) )

It probably won't work because the bindings in the namespace are 
probably locked, so you might want to unlock them first :

NAMESPACE <- asNamespace("ChainLadder")
sapply( ls( envir = NAMESPACE ), unlockBinding, env = NAMESPACE )
sys.source( "Triangle.R", env = asNamespace( "ChainLadder" ) )

But all of this is quite dangerous and won't work if the package uses 
various kinds of NAMESPACE trickery, etc ... but for packages with just 
standard functions, it might work.