-
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
mymod
inside a single module, correct?There’s a Stack Overflow question asking something quite similar.
The solution is to add a
__init__.R
file undermymod
which imports and exports the submodules:Afterwards, importing
mymod
will 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
).