The correct way to handle additional package dependencies

The package that I am developing provides several different evaluation methods. As a rule, each of them depends on the functionality provided by other packages (in some cases, with version requirements).

Until now, I just placed all these packages in the “depends” section on my description file, but the number of packages that my own package now “depends” on, although for most users only one of them will ever be relevant, so I was hoping What packages can be installed / downloaded only as needed? The documentation for writing R packages is sometimes a little complicated and has changed a bit from recent versions of R, so maybe someone can provide the latest information on this?

To illustrate this, this is a typical pattern:

doSomethingImportant<-function(params, workerFunction)
{
   #blabla
   workerFunction(partofparams)
   #moreblabla
}

and then I will have

wfA<-function(partofparams)
{
   #use something from package A
}

and

wfB<-function(partofparams)
{
   #use something from package B
}

And the user will call this function something like:

result<-doSomethingImportant(params, wfA)

, wfX. , () wfX, , / , , , ( , , workFunction doSomethingImportant, , .

, ?

+5

All Articles