This cheat sheet covers the built-in R language and functions available without loading any external packages. It spans the building blocks of R programming, from interactive help and package management to vectors, data frames, control flow, and statistical distributions.

What’s covered#

  • Getting help – ?, help.search(), help(package=)
  • Working directory – getwd(), setwd()
  • Using packages – install.packages(), library()
  • Creating vectors – c(), :, seq(), rep()
  • Vector functions – sort(), rev(), table(), unique()
  • Selecting vector elements – by position and by value
  • Reading and writing data – read.table(), read.csv(), write.csv()
  • Programming – for loops, while loops, if/else statements, functions
  • Distributions – density, distribution, quantile, and random functions