This page is obsolete. Please see the “cheat sheet” section of this page. Resources for Mining + R languageinstead.
There must be 50 R summaries in the form of “cheat sheets”. Each is designed for slightly different purposes, e.g. for ggplot2, RStudio, etc. Here are a few that I find are especially good. Feel free to list your own favorites in the comments.
Ultimate R_Cheat_ for Data Management is a good place to start. This covers importing, summarizing, and basic manipulation. Here are its first few rows. (The author uses Z=c(1,2) for assignment. IMO it is better to use Z <- c(1,2) complete with extra spaces.
- dat1 <- read.csv(“name.csv”) to import a standard CSV file (first row are variable names).
- attach(dat1) to set a table as default to look for variables. Use detach() to release.
- dat1 <- read.delim(“name.txt”) to import a standard tab-delimited file.
- dat1 <- read.fwf(“name.prn”, widths=c(8,8,8)) fixed width (3 variables, 8 characters wide).
- head(dat1) to check the first few rows and variable names of the data table you imported.
More advanced cheat sheets, covering the dplyr package and other more advanced functions, are available from RStudio (now owned by Microsoft). Do not start with these, but they can be useful for specialized purposes.
- The whole listhttps://www.rstudio.com/resources/cheatsheets/
- One that covers RStudio commands.
Probably the most useful one overall, in my experience, from 2012. You will see lots of variations of this, all of which started with a 2004 version. Skip the earlier ones.