Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

taking care of dependencies in your functions

Tags:

r

dependencies

How do you solve the dependencies of packages within your functions? I add require(package) into the function, but I wonder if there's a preferred way of accomplishing this task.

like image 934
Roman Luštrik Avatar asked Feb 26 '23 23:02

Roman Luštrik


1 Answers

According to the function's help, require is designed for use inside other functions; it returns FALSE and gives a warning (rather than an error as library() does by default) if the package does not exist

and later on...

The source code for a package that requires one or more other packages should have a call to require, preferably near the beginning of the source, and of course before any code that uses functions, classes or methods from the other package

like image 187
Brani Avatar answered Mar 01 '23 16:03

Brani