R Cheatsheet Essentials – The best R cheats — collected, printed, bound!

R
Cheatsheets
statistics
Author

Johannes Titz

Published

April 2, 2023

Just in time for the new semester, I released a new booklet: The R Essential Cheat Sheets — a curated compilation of the most important cheat sheets for R.

Don’t you know this feeling?

“I know this was easy in R… what was the command again?”

Of course, you might already be using the ingenious cheat sheets from RStudio. But they are scattered across the office, printed in black and white, and somehow you keep printing them again and again because you can never remember where you put them.

Not anymore.

The solution is simple: collect, curate, print, and bind.
What I’m offering here is the first carefully curated collection of essential R cheat sheets, optimized for printing and everyday use.

Do we really need this?

Well — at least I do.

When I think “How did I do this last time?”, I turn to page 10 and immediately see that the U-test in R is called wilcox.test, and that the paired version is simply

wilcox.test(..., paired = TRUE)

That’s much faster than opening a browser, googling, and hunting for the right Stack Overflow answer.

Productivity boost. R at speed.

Or take cluster analysis: What was the name of that distance measure that works across all scale levels? Something with g?

Turn to page 12 and there it is:

“Gower is particularly interesting because it can be used with mixed data types.”

How do I change scales in ggplot2?
How do I parse dates with lubridate?
Wide to long (or back again) in tidyr — how did that work?

About 99% of the R commands you’ll use in the next few years are condensed into 35 pages: visualized, intuitive, and immediately accessible.

Which cheat sheets are included?

  1. Basic Statistics
    Descriptive statistics, t-tests, ANOVA, contrast analysis, non-parametric tests, power analysis, correlation, regression, exploratory factor analysis, cluster analysis

  2. Base R
    Help, packages, working directory, vectors, programming, reading and writing data, data types, math functions, assignment, environments, matrices, lists, data frames, strings, factors, distributions, plotting, dates

  3. Data Import (readr, readxl, googlesheets4)
    Reading, writing, column specification

  4. Data Tidying (tidyr)
    Tibbles, reshaping data, splitting cells, expanding tables, handling missing values, nested data

  5. Data Transformation (dplyr)
    Summarizing, grouping, case manipulation, variable transformation, vectorized functions, joins

  6. Data Transformation (data.table)
    Basics, subsetting, grouping, chaining, reshaping, combining, apply functions, reading and writing data

  7. Data Visualization (ggplot2)
    Geoms, stats, scales, coordinate systems, themes, faceting, labels, legends, zooming

  8. Apply & Lists (purrr)
    Map functions, shortcuts, working with lists

  9. Strings (stringr)
    Detecting matches, mutating strings, subsetting, splitting and joining, ordering, helpers, regular expressions

  10. Regular Expressions
    Character classes, metacharacters, lookarounds, groups, anchors, quantifiers

  11. Factors (forcats)
    Inspecting, combining, ordering levels, modifying and dropping levels

  12. Dates & Times (lubridate)
    Date-times, rounding, stamping, time zones, arithmetic

  13. R Markdown / Quarto
    Workflow, knitr, citations, tables, output formats, rendering, sharing

  14. IDE (RStudio / Posit)
    Documents and apps, editor features, version control, debugging, package development, shortcuts, visual editor

  15. Package Development (usethis, devtools)
    Structure, workflow, DESCRIPTION, NAMESPACE, documentation, tests, pkgdown, data, release states

  16. Shiny
    Building apps, UI, layouts, reactivity, inputs, outputs, deployment

  17. Git
    Basics, remotes, undoing changes, rewriting history, branches

Important:
Most of these cheat sheets are already available individually as PDFs (just google “R cheat sheets”).
The idea of this collection is different: a minimal, essential selection, optimized for high-quality printing and long-term use.

Ok, ok — I want it, but…where can I buy this?

Sven Mandel / CC-BY-SA-4.0 / Modified: Added text

Well, here you go:

https://www.amazon.de/dp/B0BZ2T71CQ

Sorry — this is an insider joke that mainly works for Germans 😉
If you’re curious, check out the artist Alligatoah.

But the Cobra Car cheat is missing…

vroooom

No — we’re not playing Age of Empires II. We’re playing R 4.5.2.

Do you have suggestions to improve the cheat sheets? Are some cheats missing — or incorrect?

I’m happy about any feedback. Just write to cobracar at johannestitz.com — or leave a review on Amazon.