How to create a Metapackage?

Hi everyone!
I want to develop a metapackage: a package that import and install (if not have it) a series of packages given by a vector or list.
The problem is that I didn't find any kind of documentation or best practices about this topic. For my code I based on the tidyverse but I'm not sure that I'm doing it in the best way.
So, I was wondering if anyone has some book or page that I can consult to follow best practices when you create a metapackage.

modern solution to your stated requirements 'import and install (if not have it) a series of packages " are renv Project Environments • renv (rstudio.github.io)

or if not that then perhaps, the less rigorous, more adhoccy and without focus on accurate version recording; but possibly good for rapid script writing / prototyping might be pacman trinker/pacman: A package management tools for R (github.com)

1 Like

Hi, the problem I think is we have 7 packages (we develop all of them and are not save in CRAN nor GitHub) and we want to be able to share them in an easy way. Just say to people install this package instead of giving a list of them or force them to clone a project.
The pacman package is more accurate of what we want but I think it only works with CRAN or GIT packages

I wont pretend to have full understanding of what you have or what you want but it seems to me that if you have actual packages, you can compile them to binary for a target OS and distribute those to people as a single file each. Recipients would install.packages them from your binary.

1 Like

You can look at an existing metapackage as an example, e.g. the tidyverse package.

If all your packages are on CRAN, then you can simply depend/import your packages from the metapackage.

Otherwise you need to add some function into the metapackage that installs your packages from GitHub or wherever they are. There are various packages you can use in your metapackage to install from GitHub, e.g. renv ,remotes, or pak is a modern alternative.

1 Like

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.