Skip to contents

Want a good starter kit when setting out on a new R script? Copy / paste the snippet below and enjoy!

if (!require(pacman)) {install.packages("pacman")}
pacman::p_load('this.path', 'aqm', 'scales', 'psych', 'RColorBrewer', 'viridis', 
               'cowplot', 'patchwork', 'ggstatsplot', 'ggforce', 'ggh4x', 
               'ggpubr', 'ggridges', 'ggrepel', 'ggExtra', 'rstatix', 'tidytext', 'glue', 'tidyverse')

Want the best of the best for modeling? Include the following as well:

pacman::p_load('brms') # the only modeling package you'll ever need

(Though note that brms is a rather intensive package to install. Well worth it, though, once you do.)

PYSKA (Packages You Should Know About)

A listified version of many of the packages, all of which I’ve found particularly useful as a data scientist and researcher (in cognitive science + NeuroAI):

  • tidyverse: In my opinion, the be-all and end-all, hands-down GOAT ecosystem of packages for data manipulation, visualization, and modeling.
  • reticulate: A package for integrating R with Python.
  • citr: A package for managing citations in RMarkdown documents.
  • tinytex: A package for managing LaTeX distributions and engines.
  • boomer: A package for inspecting data processing pipelines.

ggplot Extensions

Tools for working with ggplot2 I find myself almost always loading:

  • patchwork: A package for arranging ggplot2 plots. Includes:
    • Intuitive specification of plot layout with operators + and /. Example:

      design <- "
      AABB
      AABB
      AACC
      "
      p1 + p2 / p3 + plot_layout(design = design)
  • cowplot: A package for arranging ggplot2 plots. Includes:
    • plot_grid()
    • get_legend()
  • ggh4x: A cornucopia of ggplot2 extensions. Includes:
    • facet_nested()
    • force_panel_sizes()
    • facetted_pos_scales()
  • ggtext: A package for adding formatted text to ggplot2 plots. Includes:
    • element_markdown()
    • geom_richtext()
  • ggforce: A package for statistical transformations in ggplot2. Includes:
    • geom_mark_hull()
    • radial_trans()
    • geom_bspline()
  • tidytext: A package for text mining and analysis. Includes the scale management functions:
    • reorder_within()
    • scale_{x,y}_reordered()
  • ggpubr: A package for creating publication-ready ggplot2 plots. Includes:
    • ggsummarystats()
    • stat_cor()
    • stat_compare_means()
  • ggstatsplot: A package for publication-ready plots with statistical details.
  • ggeasy: A package for simplifying common ggplot2 design + theme management.
  • ggside: A package for adding side panels to ggplot2 plots.
  • ggridges: A package for creating ridgeline plots.
  • ggrepel: A package for adding labeled text to ggplot2 plots.
  • ggExtra: A package for adding ggMarginal() plots.
  • ggstance: Horizontal ggplot2 (now deprecated in favor of base ggplot2).
  • ggfortify: Expanded autoplot functionality for ggplot2.