Using the R-Universe

[This article was first published on Pachá, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Using the R-Universe

The R-Universe, created by Jeroen Ooms, provides a very simple way to create personal CRAN-like repos, which means a way to show your collection of tools in use to the community.

In addition, you can use it to publish articles by using rmarkdown, an R package that allows you to write text and code, and generate a PDF document even with the templates required for the journal where you want to publish.

To install leontief or any other package from my R-Universe section, you can do this:

# Install new leontief version
install.packages("leontief", repos = "")

Here are some universes that you can add permanently to your configuration:

# Enable some universes
options(repos = c(
    pachadotdev = '',
    tidyverse = '',
    rlib = '',
    tidymodels = '',
    rspatial = ''
    CRAN = ''))

Creating your own R-Universe

This is particularly useful if you teach courses and you provide, for example, data packages for your students, or if you have packages that you don’t mind sending to CRAN.

In order to join the R-Universe, you need a GitHub profile, and a very good reference to start with Git and GitHub is Happy Git and GitHub for the useR.

For example, tradepolicy is a repository where I have all the codes to reproduce the results from [An Advanced Guide to Trade Policy Analysis]. It is of my interest to list the R packages used there, and in other repositories, so that in the R-Universe other users can easily discover the tools I use.

When you visit the R-Universe you’ll see this landing where you have to click ‘Setup’.

r-universe landing page, on the left menu you have to
click 'setup'

Then you have to select you personal profile (or an organizational account if you have authorization).

github page where you have to click the account to use with the

Now you can chose all your repositories or just a few. I’ll pick just gravity and tradepolicy, and a few others and then I clicked ‘Install’.

if you want to add all your repositories select 'all repositories', then
click install

to select a few repositories click 'only select repositories' and add what
you need from the list, then click install

You’ll be asked to confirm R-Universe access to your repositories.

type your password and click the 'confirm password' button

Once it’s ready, you’ll see this

the site that r-universe shows when you confirm access from github

And the URL to your repository will be of the form
( in my case)

A few minutes after setting it up, the site shall look like this:

the site that r-universe shows when it's ready or almost ready

Please notice that the repositories that I’ve added are R packages, you can just add a list of packages (i.e. ‘I use dplyr, haven, etc’) to R-Universe if you create a repository with a packages.json file.

This is how to add a list of your favourite packages to the R-Universe:

  1. Go to and create a new repository

click the plus sign on the top right and then 'new repository'

  1. Name your repository “universe” (or any other name), set is as public and with a suitable license (I like Apache license) and proceed with the steps from the image. The specific steps are

type a repository name, select the option 'public', choose the license 
(i.e. apache), then click 'create repository'

  1. Create a new file packages.json containing your packages

click 'add file' and then 'create new file'

type the file name 'packages.json' in the first box, then list your 
packages in the larger text box

scroll down and click 'commit changes'

Here’s the template text that I used:

    "package": "tradepolicy",
    "url": ""
    "package": "leontief",
    "url": ""
    "package": "tradestatistics",
    "url": ""
    "package": "gravity",
    "url": ""
    "package": "arrow",
    "url": ""
    "package": "RVAideMemoire",
    "url": ""
  1. If you added a few repositories to R-Universe, add the newly created universe repo, otherwise you are ready

click the profile icon on the top right and then click 'settings'

click 'applications' and then 'configure' to the right of the 'r-universe' icon

add the new repository, and then click 'save'

To leave a comment for the author, please follow the link and comment on their blog: Pachá. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)