Short version: I'm working on an R package, and I currently have a stable version. I have some updates to make, and would like to compare the updated version of the code to the stable version in the same R environment. How do I do this?
I'm new to package development, and I suspect dev_mode is helpful here, but ?dev_mode hasn't helped me.
Long version: Here's the main problem I have... Inside the package (let's call it somePackage
) I have a function
foo <- function(x){
y <- bar(x) # some other function defined inside my package
y
}
If I simply duplicate somePackage
in a separate directory to make a development version, then load both, R now sees two copies of bar
, which creates a conflict. I cannot run both versions of foo
and bar
in the same R environment.
If I only had the one function, I could probably do something like somePackage::bar
and somePackage_dev::bar
, but in reality I have dozens of functions in somePackage
and making these changes would be tedious and should be unnecessary.
The key thing here is needing to run BOTH versions of foo
in the same environment so that I can quickly and easily compare the timing and output of both versions on identical inputs.