Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split an R package into two packages without disrupting users

Tags:

package

r

Suppose I'm currently developing a package called mypackage. As time goes by, many different functions have landed in there, and I want to reorganize it. So I'd like to create a new package called newpackage in which I would move some of the functions of mypackage (and include new ones later).

The problem is that I don't want original users of mypackage to get object not found errors when they want to use one of the moved functions.

So, I thought about doing the following :

  • create newpackage and move the functions
  • add into mypackage DESCRIPTION file : Depends: newpackage

As such, when people would install, upgrade or load mypackage, newpackage would be installed or loaded too, and all the functions would be available.

Do you think it would work, or would there be some problems I don't think about ?

Thanks !

like image 354
juba Avatar asked Jun 15 '26 23:06

juba


1 Answers

Isn't it so that it is not recommended to remove functions from a package without labeling them first to be depreciated?! So, maybe you proceed as you planned but before removing them from the mypackage, you could first mark them there as depreciated and then remove them from it finally in the next version of the package. And during the migrating phase you could use the namespace of the packages to refer already to the function in newpackage as you planned.

like image 112
Daniel Fischer Avatar answered Jun 18 '26 14:06

Daniel Fischer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!