Underrated CRAN Packages

Project
R
A search for popular R packages, that I would would otherwise miss.
Author

Mark Edney

Published

March 31, 2022

I sit here looking for inspiration, nothing interesting to write about. Perhaps there are some popular R packages on CRAN that I don’t know about? You can explore the data on downloads from CRAN with the cranlogs package.

Top CRAN downloads

With the following code, we can get the most popular packages from CRAN. The CRAN directory doesn’t represent all R packages, but a good amount of them.

library(tidyverse)
library(cranlogs)
top100 <- cran_top_downloads(when = 'last-month', count = 100)
top100 %>% head()
  rank  package   count       from         to
1    1  ggplot2 2502873 2022-07-17 2022-08-15
2    2    rlang 2039913 2022-07-17 2022-08-15
3    3 devtools 1844834 2022-07-17 2022-08-15
4    4       sf 1756905 2022-07-17 2022-08-15
5    5      cli 1672799 2022-07-17 2022-08-15
6    6     glue 1624788 2022-07-17 2022-08-15

From this list, we can see that the tidyverse represents a large amount of the top downloads with ggplot2, rlang and dplyr. The list includes the sf package for geospacial data, the glue package for string manipulation and the cli package which is used to create a command line interface for packages. Most of these packages I already have a good understanding of, so I need to narrow down the search.

Packages installed

You can get a list of your installed packages with the installed_packages function. You can then filter the top 100 list and remove anything you already have installed to find new packages.

mine <- installed.packages() %>%
        data.frame() %>%
        select(Package)
new <- top100 %>%
        filter(!package %in% mine$Package)
new
   rank     package   count       from         to
1     3    devtools 1844834 2022-07-17 2022-08-15
2     7        ragg 1589393 2022-07-17 2022-08-15
3     8 textshaping 1583922 2022-07-17 2022-08-15
4    10       rgeos 1524077 2022-07-17 2022-08-15
5    11         rgl 1499311 2022-07-17 2022-08-15
6    18     pkgdown 1162782 2022-07-17 2022-08-15
7    19  enrichwith 1158675 2022-07-17 2022-08-15
8    20      brglm2 1154128 2022-07-17 2022-08-15
9    31         zoo  873095 2022-07-17 2022-08-15
10   50       Hmisc  706994 2022-07-17 2022-08-15
11   60     rstatix  648757 2022-07-17 2022-08-15
12   62      nloptr  637641 2022-07-17 2022-08-15
13   63        lme4  623554 2022-07-17 2022-08-15
14   68    corrplot  601404 2022-07-17 2022-08-15
15   72       rJava  577002 2022-07-17 2022-08-15
16   75      ggpubr  544839 2022-07-17 2022-08-15
17   88     cowplot  493972 2022-07-17 2022-08-15
18   94         car  461659 2022-07-17 2022-08-15

From some quick research, I have found the following about the new packages:

  • ragg - a 2D library as an alternative to the RStudio default
  • rgl - functions for 3D interactive graphics
  • rgeos - a geometry package, but is currently planned to be retired at the end of 2023 for the sf package
  • zoo - a library to deal with time series
  • pkgdown - a library fOR building a blog website, I use blogdown
  • nloptr - a library for solving non-linear optimization problems
  • Hmisc - an assortment of different data analysis tools
  • lme4 - for fitting linear and generalized linear mixed-effects models
  • RcppEigen - integration of the eigen library in R for linear algebra

Take-away

Hopefully your take-way is a simple method to explore R library that you have never heard about. I know that a few of the libraries seem interesting and worth further exploring.

While we are at it, might as well find the daily values for the new packages and plot them for the last month.

new$package %>%
        cran_downloads(when = "last-month") %>%
        ggplot(aes(x = date, y = count, color = package)) +
        geom_line()