Recommendations for developing a set of dependent packages R

I am starting to work on a family of R-packages, all of which have a common common code, which is placed in its own package, allows you to call it myPackageUtilities. Therefore, I have several packages

myPackage1, myPackage2etc.

All of these packages depend on each method in myPackageUtilities. For an example in the real world, see statnet on CRAN . The idea is that a future developer could create myPackageN, and instead of rewriting / duplicating all the supporting code, this future developer could just use myPackageUtilitiesto get started.

There are complications:

1) Some of the code in is myPackageUtilitiesintended for end users, while the rest is for internal development purposes. End-user code must be properly documented using roxygen2. This code includes both S3 classes and shared files, as well as various user support functions.

2) Dependent packages ( myPackage1, myPackage2etc.) are likely to extend the capabilities of S3 defined in myPackageUtilities.

My question is: What is the best way to put it all together? Here are two natural (but not exhuastive) options:

  • Include myPackageUtilitiesin the Import section: for all dependent packages and force users to download separately myPackageUtilities,
  • myPackageUtilities : , myPackageUtilities, . () ::: myPackage1 ..

, , . :

  • : :, , myPackageUtilities, myPackage1 ..
    • , myPackageUtilities /, .
  • S3 myPackageUtilities , rooxgen2 myPackage1?

, , , , !

+1
1

.

, , myPackageUtilities myPackage1, myPackage1, .

, , myPackageUtilities, myPackage1, , fn_name myPackage1

#' @importFrom myPackageUtilities fn_name
#' @export fn_name

(. https://github.com/hadley/dplyr/blob/master/R/utils.r )

, . , . , , @details please see the documentation for \code{\link[myPackageUtilities]{fn_name}}

, - , myPackageUtilities, - myPackageUtilities, - , myPackageUtilities .

0

Source: https://habr.com/ru/post/1626465/


All Articles