-
|
I have an old package with the classic package structure of one function in one file. So in the below, Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
If I understand you correctly, you want to “pool” all the functions defined in the files under There’s a Stack Overflow question asking something quite similar. The solution is to add a # mymod/__init__.R:
#' @export
box::use(
./fun1[...],
./fun2[...],
)Afterwards, importing Now you can use it in box::use(../mymod)
mymod$fun1()Note the relative import ( |
Beta Was this translation helpful? Give feedback.
If I understand you correctly, you want to “pool” all the functions defined in the files under
mymodinside a single module, correct?There’s a Stack Overflow question asking something quite similar.
The solution is to add a
__init__.Rfile undermymodwhich imports and exports the submodules:Afterwards, importing
mymodwill make all exported objects from the nested modules (= the source files) available.Now you can use it in
R/tryBox.R, for example:Note the relative import (
../mymod).