R Cheatsheet Essentials – die besten R Cheats, gesammelt, gedruckt, gebunden!

R
Cheatsheets
Statistik
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 compilation of the most important cheatsheets for R. Don’t you always feel like “I know that this wasy easy in R …, what was the command again?”

Or are you already using the ingenious cheatsheets from RStudio? But they are scattered around, only in black and white, poor print quality with home printers, and you keep printing them again and again because you don’t know where they are? Not anymore! Because the solution to all these problems lies in collecting, printing and binding…I offer you the first curated collection of R Cheatsheets.

Do we really need this? Well, at least I do. If I think again “Oh, how did I do this the last time?” I turn to page 10 and know that the U test in R is called wilcox.test, and the Wilcoxon test too, but with the parameter wilcox.test(..., paired = TRUE). This is much faster than opening the browser, googling and then finding the right site on stackoverflow. Productivity boost. R on speed.

What is the name of this distance measure in R for cluster analysis, the one that works at all scale levels? Something with g? Turn to page 12 of the collection and there it is: “gower is particularly interesting because it can be used with mixed data types”.

How do I change the scale of ggplot? How do I read dates into lubridate? Data from wide to long or vice versa, how did that work in tidyr? 99% of the commands that you will execute in R in the next few years are on 35 pages, condensed, visualized, intuitive.

Which cheat sheets are included?

  1. Basic Statistics (descriptive statistics, t-test, 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, types, maths functions, variable assignment, environment, matrices, lists, data frames, strings, factors, statistics, distributions, plotting, dates)
  3. Data import with readr, readxl, googlesheets4 (reading, writing, column specification)
  4. Data tidying with tidyr (tibbles, reshape data, split cells, expand tables, handle missing values, nested data)
  5. Data transformation with dplyr (summarize cases, group cases, manipulate cases, manipulate variables, vectorized functions, summary functions, combine tables)
  6. Data transformation with data.table (basics, create a data.table, subset rows, manipulate olumns, group, chaining, functions for data.table, combine, reshape, apply, sequential rows, read & write)
  7. Data visualization with ggplot2 (basics, geoms, stats, scales, coordinate systems, position adjustments, themes, faceting, labels and legends, zooming)
  8. Apply and Lists with purrr (map functions, function shortcuts, work with lists)
  9. Strings with stringr (detect matches, mutate strings, subset strings, join and split, manage lengths, order strings, helpers, regular expressions)
  10. Regular Expressions (character classes, special metacharacters, lookarounds and conditionals, functions for pattern matching, character classes and groups, anchors, quantifiers) 11 Factors with forcats (inspect, combine, order of levels, value of levels, add or drop levels )
  11. Dates with lubridate (Date times, round, stamp, time zones, math)
  12. rmarkdown (workflow, code in knitr, citations, tables, markdown, output formats, header options, render, share)
  13. IDE (documents and apps, source editor, tab panes, version control, debug mode, package development, shortcuts, visual editor, workbench)
  14. Development with usethis and devtools (structure, getting started, workflow, R path, DESCRIPTION, NAMESPACE, man, vignettes, pkgdown, tests, README.Rmd+NEWS.md, data, package states)
  15. shiny (building an app, share, outputs, inputs, reactivity, UI, layouts, themes)
  16. git (basics, remote repositories, undoing changes, rewriting history, branches)

Important: Most of the cheatsheets are also directly available as pdf. Just google “cheatsheets R”. There are a few dozen of them. The idea of this collection is to have a minimal version, just the essentials, but as a print version with good quality.

Ok, ok, I want it, but…

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

Well, here: https://www.amazon.de/dp/B0BZ2T71CQ

Sorry, this is just an insider joke that works for Germans ;). Check out the artist Alligatoah, if you want to know more.

But the Cobra car cheat is missing…

vroooom

No, we are not playing Age of Empires 2, we are playing R 4.3.2. Do you have suggestions on how to improve the cheat sheet? Which cheats are missing? Or are some cheats incorrect? I am happy about any feedback, just write to cobracar at johannestitz.com. Or leave a direct review on Amazon.