Reputation: 895
I am currently creating an R package and have the following issue. The package has one R routine, say aR, and two Rcpp routines, say bC and cC. Both aR and bC call cC. I would like the user to be able to create their own version of cC.
One solution would of course be to simply "open" the code of the three routines so a user can replace cC and just reinstall the package, but the actual package contains almost 20 routines and I don't want to make most of these visible to the user.
I tried the following already:
environment(newcC) <- asNamespace('packagename')
assignInNamespace("cC", newcC, ns = "packagename")
and that works for aR, it now runs cC instead of newcC. But it does not work with bC, it keeps using the original routine cC.
Upvotes: 1
Views: 48
Reputation: 895
IceCreamToucan's suggestion to simply make cC an argument works just fine, so thanks!
Wolfgang
Upvotes: 0