Below is a list of free books, tutorials, packages, cheat sheets and other material to learn programming in R and improve your workflow. There are separate overviews for Python resources, SQL resources, and general Data Science, Machine Learning, & Statistics resources. If you have additions, please comment below or contact me!
Completely new to R? → Start here!
LAST UPDATED: 26-03-2018
R Basics
Cheat Sheets:
- Base R cheat sheet by Mhairi McNeill***
- Base R Functions cheat sheet by Tom Short
- Basic R cheat sheet by Quandl.com
- R Function Abbreviations Explained by Jeromy Anglim
- RStudio cheat sheet by RStudio
- RStudio Keyboard Shortcuts by RStudio***
- Data Management in R cheat sheet
data.table
wide cheat sheet by DataCamp.comdata.table
long cheat sheet by DataCamp.com- Advanced R cheat sheet by Arianne Colton & Sean Chen
tidyverse
cheat sheet by DataCamp.com
- Data Import cheat sheet by RStudio with
readr
,tibble
, andtidyr
- Factor Manipulation with
forcats
cheat sheet by Lise Vaudor - Data Transformation cheat sheet by Rstudio with
dplyr
- Data Transformation cheat sheet 2 by Daniel Lüdecke with
dplyr
andsjmisc
- Data Wrangling cheat sheet by RStudio with
dplyr
andtidyr
- Character String Manipulation cheat sheet by RStudio with
stringr
- Dates and Times cheat sheet by RStudio with
lubridate
- Split-Apply-Combine cheat sheet by Ernest Adrogue Calvera
purr
Functional Programming cheat sheet by RStudio- Tidy Evaluation by Edwin Thoen
- R Syntax Comparison cheat sheet by Amelia McNamara
- RStudio cheat sheet GitHub
Introductory Books:
- Introduction to R (R Core Team, 1999)
- R Language Definition (Manual) (R Core Team, 2000)
- Data Import/Export (R Core Team, 2000)
- SimpleR (Verzani, 2001-2)
- R for Beginners (Paradis, 2002)
- Introduction to R (Spector, 2004)
- Ecological Models and Data in R (Bolker, 2007)
- Software for Data Analysis: Programming with R (Chambers, 2008)
- Econometrics in R (Farnsworth, 2008)
- The Art of R Programming (Matloff, 2009)
- R in a Nutshell (Adler, 2010)
- R in Action: Data Analysis and Graphics with R (Kabacoff, 2011)
- R for Psychology Experiments and Questionnaires (Baron, 2011)
- The R Inferno (Burns, 2011)
- Cookbook for R (Chang, ???)
- The R Book (Crawley, 2013)
- Introduction to Statistical Thought (Lavine, 2013)
- A (very) short introduction to R (Torfs & Bauer, 2014)***
- Advanced R (Wickham, 2014)
- Introduction to R (Vaidyanathan, 2014)
- Learning statistics with R: A tutorial for psychology students and other beginners (Navarro, 2014)
- Introduction to R (Venables, Smith, & R Core Team, 2017)
- The R Language Definition (R Core Team, 2017)
- YaRrr! The Pirate’s Guide to R (Phillips, 2017)***
Online Courses: Introductory & Advanced:
swirl()
***- Try R by Code School
- Learn R by R-Exercises
- R Tutorial by Cyclismo & DataCamp
- 100 Tutorials for Learning R
- Introduction to R by DataCamp
- YaRrr! The Pirate’s Guide to R (Video)
- R for Cats
- A Psychologist’s Guide to R (pdf) by Sean Chris Murphy
- Social Sciences: Critically Analyze Research and Results Using R by Coursera
- A Hands-on Introduction to Statistics with R by DataCamp.com
- R Course in Statistics by PagePiccini.com
- Mini courses in R by UCLA
- Data Science: R Basics @edX
- Introduction to R for Data Science @edX
- Data Analysis and Visualization Using R @VarianceExplained
- R Programming @Coursera*** by Roger Peng, Jeff Leek, & Brian Caffo
- DIY: 37 Youtube R Tutorials Overview by Flavio Azevedo***
Style Guides:
- Google’s R Style Guide
- Advanced R Style Guide by Hadley Wickham
- A guide for switching from base R to the
tidyverse
.
Data Visualization in R
- R Graph Gallery & Code Examples***
- Fundamentals of Data Visualization (Wilke, 2018)
- R Base Plots Wiki Reference Guide
- CRAN Task View – Graphics & Visualization
- R Graphical Parameters Cheatsheet by Flowingdata.com
Colors
- R Color Guide***
- colourpicker – widget that allows users to choose colours
- ggplot2 colour guide***
- multicolored annotated text in ggplot2 by Andrew Whitby & Visuelle Data
Interactive / HTML widgets:
- R HTML Widgets Gallery***
- plotly – interactive plots
- d3heatmap – interactive d3 heatmaps
- DT – interactive tables
- DiagrammeR – interactive diagrams
- dygraphs – interactive time series plots
- formattable – formattable data structures
- ggvis – interactive ggplot2
- Highcharter – interactive Highcharts plots
- leaflet – interactive maps
- metricsgraphics – interactive JavaScript bare-bones line, scatterplot and bar charts
- networkD3 – interative d3 network graphs
- scatterD3 – interactive scatterplots with d3
- rbokeh – interactive Bokeh plots
- rCharts – interactive Javascript charts
- rcdimple – interactive JavaScript bar charts and others
- rglwidget – interactive 3d plots
- threejs – interactive 3d plots and globes
- visNetwork – interactive network graphs
- wordcloud2 – interface to wordcloud2.js.
- timevis – interactive timelines
ggplot2
- Code examples of top-50 ggplot2 visualizations***
- ggplot2 Cheatsheet by RStudio
- ggplot2 Quick Reference Guide
- ggplot2 Code Snippets
- ggplot2 Code Snippets 2
- A practical introduction with R and ggplot2 (Healy, 2017)
- Data Vizualization: A practical introduction (Healy, 2018)
- Hitchhiker’s Guide to ggplot2 in R (Burchell & Vargas, 2016)
- Setting custom ggplot themes with
ggthemr
- Creating custom, reproducible color palettes by Simon Jackson
- Rearranging values within ggplot2 facets
- Combine plots using
patchwork
orcowplot
- ggplot2 extensions overview***
ggthemes
– plot style themeshrbrthemes
– opinionated, typographic-centric themesggmap
– maps with Google Maps, Open Street Maps, etc.ggiraph
– interactive ggplotsggstance
– horizontal versions of common plotsGGally
– scatterplot matricesggalt
– additional coordinate systems, geoms, etc.ggforce
– additional geoms, etc.ggrepel
– prevent plot labels from overlappingggraph
– graphs, networks, trees and moreggpmisc
– photo-biology related extensionsgeomnet
– network visualizationggExtra
– marginal histograms for a plotgganimate
– animationsggspectra
– tools for plotting light spectraggnetwork
– geoms to plot networksggradar
– radar chartsggsurvplot (survminer)
– survival curvesggseas
– seasonal adjustment toolsggtech
– style themes for plotsggtern
– ternary diagramsggTimeSeries
– time series visualizationsggtree
– tree visualizationstreemapify
– wilcox’s treemaps
Miscellaneous
coefplot
– visualizes model statisticscirclize
– circular visualizations for categorical dataquantmod
– candlestick financial chartscolorspace
– HSL based color palettesviridis
– Matplotlib viridis color pallete for Rmunsell
– Munsell color palettes for R.Cairo
– high-quality display outputigraph
– Network Analysis and Visualizationlattice
– Trellis graphicstmap
– thematic mapstrelliscopejs
– interactive alternative for ggplot2::facet_wraprgl
– interactive 3D plotscorrplot
– graphical display of a correlation matrixgoogleVis
– Google Charts APIplotROC
– interactive ROC plotsextrafont
– fonts in R graphicsshowtext
– text using system fontsanimation
– animated graphics using ImageMagick.misc3d
– 3d plots, isosurfaces, etc.xkcd
– xkcd style graphicsimager
– CImg library to work with images
Dashboards & Shiny
- Shiny Cheat Sheet by RStudio
- More Shiny Resources by Rob Gilmore
- More Shiny Resources for Statistics by Yingjie Hu
- Shiny Tutorial
- Building Shiny apps – an interactive tutorial by Dean Attali
flexdashboard
– dashboard creation simplifiedcolourpicker
– widget that allows users to choose colours.
Regular Expressions in R
-
- R Regular Expression Cheatsheet by Lise Vaudor
- R Regular Expression Cheatsheet
- R Regular Expression Cheatsheet (page 2) by RStudio
- Regular Expressions in R – Part 1: Introduction and base R functions
- R Regular Expressions by Jon M. Calder in swirl()
- R Regular Expression Video Tutorial by Roger Peng
- General Regular Expression Cheatsheet
- General Regular Expression Video Tutorial by Roger Peng
- General Regular Expression Cheatsheet by OverAPI.com
R Markdown & Documentation
- R Markdown Cheatsheet by RStudio
- R Markdown Reference Guide by RStudio
- R Markdown Basics
- Markdown Tutorial by RStudio
- Markdown Gallery by RStudio
- The
knitr
book (Xie, 2015) - Creating slides with R Markdown (Video) by Brian Caffo
- General Markdown Cheatsheet
blogdown
: Creating Websites with R Markdown (Xie, Thomas, & Hill, 2018)blogdown
tutorials- Packages:
R Database Linking
- Tutorial: Database Queries with R
- Introduction to
sparklyr
by DataCamp dbplot
– leveragesdplyr
to process calculations of plot inside database
Functional Programming
- Functional Programming lecture by Duke University
- Functional Programming:
purrr
tutorial by Jenny Bryan purr
Functional Programming cheat sheet by RStudio- Writing Function in R by DataCamp.com
Statistical Learning, Machine Learning, & Data Science
- Machine Learning with R: An Irresponsibly Fast Tutorial by Will Stanton***
- CRAN Task View – Machine Learning & Statistical Learning
- R Packages for Machine Learning by Joseph Misiti
- Introduction to Data Science with R (Video)
- Course: Introduction to R for Data Science @Microsoft
- Course: Introduction to R for Data Science @FutureLearn by Hadley Wickham
- Introduction to Statistical Learning (James, Witten, Hastie, & Tibshirani, 2013)
- Course: Introduction to Statistical Learning (Hastie & Tibshirani, 2014)***
- Data Science Live Book (Casas, 2017)
- 100 Tutorials for Learning R
- R Programming for Data Science (Peng, 2016)
- R for Data Science (Grolemund & Wickham, 2017)***
- Elements of Statistical Learning (Hastie, Tibshirani, & Friedman, 2001)
- Statistical Foundations of Machine Learning (Bontempi & Taieb, 2017)
- Machine Learning with R (Lantz, 2013)
- R Functions for Regression Analysis Cheatsheet by Vito Ricci
- Regression Models for Data Science in R (Caffo, 2015)
- Applied Biostatistical Analyses using R (Cox, 2017)
- Data Mining with Rattle and R: The Art of Excavating Data for Knowledge Discovery (Williams, 2011)
- Machine Learning Algorithms R Implementation by Ajitesh Kumar
- R Data Mining Reference Card
- R Data Mining: Examples & Case Studies (Zhao, 2015)
- Statistical modelling in R (Zhao, 2015) @RDataMining
- Predictive modelling in R with
caret
- Machine Learning with
caret
cheat sheet by Max Kuhn - R
sparklyr
cheat sheet by RStudio - Machine Learning modelling cheat sheet by Arnaud Amsellem
- Machine Learning with
mlr
cheat sheet by Aaron Coley - Deep Learning with
keras
cheat sheet by RStudio - R Interface to Keras
Natural Language Processing & Text Mining
- Text Mining Tutorial with
tm
- Tidy Text Mining (Silges & Robinson, 2017) with
tidytext
- Text Analysis with R for Students of Literature (Jockers, 2014)
- 100 Tutorials for Learning R
- 21 Recipes for Mining Twitter Data (Rudis, 2017) with
rtweet
- Course: Introduction to Text Analytics with R @DataScienceDojo
- Course: Twitter Text Mining and Social Network Analysis (Zhoa, 2016) @RDataMining with
twitteR
- List of resources for NLP & Text Mining by Stephen Thomas
- Packages — for an overview: CRAN Task View – Natural Language Processing:
tm
– text mining.tidytext
– text mining usingtidyverse
principlesquanteda
– framework for quantitative text analysisgutenbergr
– public domain works (free books to practice on)corpora
– statistics and data sets for corpus frequency data.tau
– Text Analysis UtilitiesSentiment140
– headache-free sentiment analysissentimentr
– sentiment analysis using text polarityopenNLP
– sentence detector, tokenizer, pos-tagger, shallow and full syntactic parser, named-entity detector, and maximum entropy models with OpenNLP.cleanNLP
– natural language processing via tidy data modelsRSentiment
– English lexicon-based sentiment analysis with negation and sarcasm detection functionalities.RWeka
– data mining tasks with Wekawordnet
– a large lexical database of English with WordNet .stringi
– language processing wrapperstextcat
– provides support for n-gram based text categorization.text2vec
– text vectorization, topic modeling (LDA, LSA), word embeddings (GloVe), and similarities.lsa
– Latent Semantic Analysistopicmodels
-Latent Dirichlet Allocation (LDA) and Correlated Topics Models (CTM)lda
-Latent Dirichlet Allocation and related models
Time series
- CRAN Task View – TimeSeries
- R xts Cheatsheet
- Forecasting: Principles and Practice (Hyndman & Athanasopoulos, 2017)
- A little book of R for time series (tutorial)
- Tutorials: Part 1, Part 2, Part 3, & Part 4 of tidy time series @Business-Science.io with tidyquant
Survival analysis
- CRAN Task View – Survival
- R Survival Analysis Cheatsheet by Przemysław Biecek
- survival – functionality for survival and hazard models
- ggsurvplot (survminer) – survival curves
Geographical / Spatial mapping
- Making Maps with R (tutorial) with ggmaps, maps, and mapdata
- Importing OpenStreetMap data (tutorial) with osmar
Other applications
- Image featurization
- Introduction to Empirical Bayes (Robinson, ???)
- CRAN Task View – Bayesian Inference
R Development, Optimization & Other
- R Package Development Cheatsheet with devtools
- Mastering Software Development in R (Peng, Kross, & Anderson, 2017)
- Efficient R Programming (Gillespie & Lovelace, 2017)
- Happy Git and GitHub for the useR (Jenny Bryan, 2017)
- RStudio Addins by Dean Attali
R Help, Connect, & Inspiration
- R Help Mailing List
- R Seek – search engine for R-related websites
- R site search – search engine for help files, manuals, and mailing lists
- Nabble – mailing list archive and forum
- R User Groups & Conferences
- Stack Overflow – a FAQ for all your R struggles (programming)
- Cross Validated – a FAQ for all your R struggles (statistics)
- CRAN Task Views – discover new packages per topic
- The R Journal – open access, refereed journal of R
- Twitter: #rstats, RStudio, Hadley Wickham, Yihui Xie, Mara Averick, Julia Silge, Jenny Bryan, David Smith, Hilary Parker, R-bloggers
- Facebook: R Users Psychology
- Youtube: Ben Lambert, Roger Peng
- Reddit: rstats, rstudio, statistics, machinelearning, dataisbeautiful
R Blogs
- http://adamleerich.com
- http://njtierney.github.io/
- https://trinkerrstuff.wordpress.com
- https://rollingyours.wordpress.com
- https://www.r-statistics.com
- https://beckmw.wordpress.com
- http://rgraphgallery.blogspot.com
- http://onertipaday.blogspot.com
- https://learnr.wordpress.com
- http://padamson.github.io
- http://www.r-datacollection.com/blog/
- http://www.thertrader.com
- https://fronkonstin.com
- https://nicercode.github.io
- http://www.rblog.uni-freiburg.de
- https://advanceddataanalytics.net
- http://r4stats.com/blog/
- http://blog.revolutionanalytics.com/
- http://www.r-bloggers.com/
- http://kbroman.org/blog/
- https://juliasilge.com/blog/
- http://andrewgelman.com/
- http://www.statsblogs.com/author/eric-cai-the-chemical-statistician/
- https://www.statmethods.net/
- http://www.stats-et-al.com/search/label/R
R Jobs