Reputation: 169
I'm debating on how to structure my R package. It is difficult to create a minimal working example, but I'll try to explain via an analogy. I need to read in, analyse and visualise data for 4 different types of projects. The reading and analysing will be mostly different for the 4 types of projects, but the visualising will have many similarities (plot style, plot type, LaTeX output using the same LaTeX .sty file, etc).
Now I'm thinking of how to include this so it will remain structurally nice. I have seen large packages created as a group of multiple packages in Python (example is Qiskit, made up of Terra, Aer, Ignis and Aqua), but could not find anything online about R. The reason I want this is because I want everything grouped together nicely for these 4 types of projects.
So say I have these 4 types of projects all needing a package pkg-type-i
(i
from 1
to 4
) with in their R/
folders the files fnct1.R
, fnct2.R
etc, should (and can) I make:
big-pkg
consisting of
pkg-type-1/
pkg-type-2/
pkg-type-3/
pkg-type-4/
pkg-visualisation/
Or should I structure it as follows, with my R/
directory in big-pkg
as follows:
R/
type1.fnct1.R
type1.fnct2.R
...
type2.fnct1.R
...
visualisation.R
The final option is how structuring a package is being taught in r-pkgs.org but the toy package there is way smaller. I want to have this structurally neat so one can find everything quickly. I do not know where to look for how to structure a package this big and want to prevent having an R/
folder that large. So what is the best solution here?
Upvotes: 1
Views: 206
Reputation: 18500
The idea of grouping several packages into a meta-package is not uncommon. For instance, there is the tidyverse package, or the mlr3verse, or the healthyverse.
There is even a package pkgverse which aims to help creating meta-packages.
If you are working with S4 classes, implementing generics over different packages can be more difficult than with R6.
Upvotes: 1