I have created a package 'mypackage' (with a namespace 'mypackage' attached) In this package there is a function that I can call either with
'myfunction'
or
'mypackage::myfunction'
Now I want to replace myfunction by another version (updated).
I used to do
source(path)
where path is the path of a file where the updated 'myfunction' is defined
Now I moved to R 2.14.x and this system doesnt work because apparently R checks first if there is a function inside the same namespace, and if there is one, it uses this one and not the others.
My question: how can I push the updated function to be in the same namespace as the package one?
See
?assignInNamespace
. For examplewill assign the object
foo
to the object named"myfunction"
in namespace"mypackage"
.foo
can be whatever object you want, evenmyfunction
but you will need to be careful to ensure you callmypackage::myfunction
if you also havemyfunction
in the global environment/workspace.