R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.
R Programming Language
R is a free, open-source programming language and software environment for statistical computing, bioinformatics, information graphics, and general computing. It is a multi-paradigm language and dynamically typed. R is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme. R was created by Ross Ihaka and Robert Gentleman and is now developed by the R Development Core Team. The R environment is easily extended through a packaging system on CRAN, the Comprehensive R Archive Network.
Scope of questions
This tag should be used for programming-related questions about R. Including a minimal reproducible example in your question will increase your chances of getting a timely, useful answer. Questions should not use the rstudio tag unless they relate specifically to the RStudio interface and not just the R language.
If your question is more focused on statistics or data science, use Cross Validated or Data Science, respectively. Bioinformatics-specific questions may be better received on Bioconductor Support or Biostars. General questions about R (such as requests for off-site resources or discussion questions) are unsuitable for Stack Overflow and may be appropriate for one of the general, or special-interest, R mailing lists.
Please do not cross-post across multiple venues. Do research (read tag wikis, look at existing questions, or search online) to determine the most appropriate venue so that you have a better chance of receiving solutions to your question. Your question may be automatically migrated to a more appropriate Stack Exchange site. If you receive no response to your questions after a few days, or if your question is put on hold for being off-topic, it is then OK to post to another venue, giving a link to your Stack Overflow question - but don't cross-post just because your question is down-voted or put on hold for being unclear. Instead, work on improving your question.
Stack Overflow resources
- How to make a great R reproducible example
- What is the most useful R trick?
- How to get help in R?
- r-faq - Tag for frequently asked R questions on StackOverflow
- The overflow package, to assist with answering StackOverflow questions
- The reprex package for producing reproducible examples for Stack Overflow
- R Public chat
- R Meta chat
Official CRAN Documentation
- An Introduction to R (PDF, epub, HTML), a basic introduction for beginners.
- R Data Import/Export (PDF, epub), a data import and export guide.
- R Installation and Administration (PDF, epub), an installation guide (from R source code).
- Writing R Extensions (PDF, epub), a development guide for R.
- The R Language Definition (PDF, epub), a more technical discussion of the R language itself.
- R Internals (PDF, epub), internal structures and coding guidelines.
- R Reference Index (PDF), contains all help files of the R standard and recommended packages in printable form.
- The manual CRAN Repository Policy (PDF) describes the policies in place for the CRAN package repository.
Other CRAN resources
- Packages in the standard library
- R mailing lists
- Task Views - summary of useful packages by subject area.
- Free books, commercially available books and other documents on R in a variety of languages.
- The R Journal lists research articles and summaries of major revisions.
- R FAQ - Official list of R FAQs on CRAN.
- R bug tracking system - submit bug reports and patches specific to base R here, but read the guidelines first.
Free Resources
Interactive R learning
- Coursera - Learn how to use R for effective data analysis
- DataCamp - Many interactive R and data science courses
- Dataquest - Interactive R courses for data science
- edX - Basic Statistics and R (basic course, not just for life sciences)
- edX - Introduction to R Programming
- R-exercises - 1000+ R exercises and solutions
- RPubs - Easy web publishing from R
- Swirl - R-package to learn R interactively
Free books on R:
- The R Inferno (PDF) by Patrick Burns
- A Little Book of R for Bayesian Statistics by Avril Coghlan
- A Little Book of R for Biomedical Statistics (PDF) by Avril Coghlan
- A Little Book of R for Multivariate Analysis (PDF) by Avril Coghlan
- A Little Book of R for Time Series (PDF) by Avril Coghlan
- Spatial Epidemiology Notes - Applications and Vignettes in R (PDF) by Charles DiMaggio
- P9489 Practicals and Exercises (PDF) by Charles DiMaggio
- Practical Regression and Anova in R (PDF) by Julian Faraway
- Multivariate Statistics with R (PDF) by Paul Hewson
- Introduction to Probability and Statistics Using R by G. Jay Kerns
- Introduction to Statistical Thought (PDF) by Michael Lavine
- The Undergraduate Guide to R (PDF) by Trevor Martin
- R for SAS and SPSS Users (PDF) by Bob Muenchen (early draft only)
- Learning Statistics with R (PDF) by Dan Navarro
- R Succinctly by Barton Poulsen (registration required)
- An introduction to psychometric theory with applications in R by William Revelle
- Rabbit by Nicola Sturaro
- R for Data Science by Garrett Grolemund and Hadley Wickham
- Advanced R Programming by Hadley Wickham (2nd Ed in progress)
- R Packages by Hadley Wickham
- Introduction to Statistical Thinking (With R, Without Calculus) (PDF) by Benjamin Yakir
- R Programming wikibook - A collaborative textbook
- ggplot2 book by Hadley Wickham
- Introduction to Statistical Learning, with Applications in R by Gareth James, Daniela Witten, Trevor Hastie & Robert Tibshirani
- Forecasting: Principles and Practice by Rob Hyndman & George Athanasopoulos
- A Handbook of Statistical Analyses Using R by Everitt & Hothorn
- R Graphics Cookbook by Winston Chang
- Efficient R Programming by Gillespie & Lovelace
Programming Chrestomathy (problems written in many languages)
- Rosetta Code
- Learn X in Y minutes
- Anarchy golf
- Hyperpolyglot (R/MATLAB/Python)
- PLEAC (Programming Languages Examples Alike Cookbook)
- Wikibook of Hello World programs
- A MATLAB/R (PDF) language comparison reference guide by David Hiebeler
- An older MATLAB/Python/R language comparison reference guide by Vidar Bronken Gundersen
Other free resource materials
- The Journal of Statistical Software has many papers about R packages
- The knitr site by Yihui Xie has resources on reproducible research using that package
- R by example by Ajay Shah
- R language for programmers by John D. Cook
- Hands on dplyr tutorial for faster data manipulation in R
IDEs and editors for R
- ESS (Emacs Speaks Statistics) - package for Emacs and XEmacs
- RStudio - R-specific IDE
- RStudio Cloud - Cloud version of RStudio
- Rkward - Open source R-specific IDE for GNU/Linux, Windows and Mac
- Architect - a remix of the Eclipse IDE with the StatET plugin
- R Tools for Visual Studio - open source plugin for Visual Studio
- TERR (TIBCO Enterprise Runtime for R) - commercial IDE with its own R engine
- R AnalyticFlow - Simple workflow-focused IDE.
- JGR - Java-based GUI for R
- Tinn-R - R-specific code editor
- Sciviews-K - Extension for the Komodo IDE
- NppToR - plugin for Notepad++
- Vim-R - plugin for Vim
- Rgedit - plugin for gedit and pluma
- Deducer R Editor
- Microsoft R Open - Enhanced open-source R engine.
- Pycharm with R plugin
- vscode with R extension - open source lightweight R and modern (in 2022) IDE
Web application framework for R
- Shiny - Turn your analyses into interactive web applications. No HTML, CSS, or JavaScript knowledge required.
- FastRWeb - Fast Interactive Web Framework for Data Mining Using R
Graphical User Interfaces (GUI) in R
- R Commander
- Rattle for Data Mining
- Deducer for Data Visualization
- JGR
Code style guides
- R internal coding standards
- Bioconductor code style and package guidelines
- Google's
- The tidyverse style guide by Hadley Wickham
- Colin Gillespie’s
- Henrik Bengtsson’s
- Paul E Johnson’s
Other Resources
Recommended additional R resources include:
- RSeek - a search engine for R (Firefox search plugin).
- Cookbook for R - solutions to common tasks in data analysis and visualization.
- Quick-R - accessing the power of R.
- R on Wikipedia and Wikiversity.
- R-bloggers - R blog aggregator.
- Inside-R and the R Graphical Manual - enhanced versions of CRAN's R Reference Index.
- STHDA - Statistical tools for high-throughput data analysis - several tutorials
- Pluralsight Course - online video course for beginners.
- CRANberries - news feed on CRAN package updates.
- Rdocumentation - R domain search engine
- rOpenSci - R packages that provide programmatic access to a variety of scientific data, full-text of journal articles, and repositories that provide real-time metrics of scholarly impact.
- R Tips - A list of quick tips on using R, by Paul E Johnson.
- R-builder - Tools and guide for setting up continuous integration of R packages using Travis CI and SemaphoreCI.
- R Weekly - A weekly curated selection of updates from the entire R community
Alternative R engines
All alternative R engines have the goal of increasing R's performance and memory management.
Downstream distributions with complete compatibility
- Microsoft R Open bundles R with the Intel Math Kernel library, a fast parallel library for matrix math
- Microsoft R Server
- Oracle R distribution, part of Oracle R Enterprise (C-based).
Forks of R with near 100% code compatibility
- pqR by Radford Neal (C-based).
- Rho by Karl Millar, based upon CXXR by Andrew Runnalls (C++-based). The development on Rho has been suspended indefinitely.
Rewrites with high code compatibility
Experimental and early-stage rewrites
Unrelated tags
Due to R's simple name, questions sometimes get tagged with the r tag when a different topic is meant. Here is a list of tags that mistagged R questions might be re-tagged to
- r.java-file for questions related to the file
R.java
on android - r.js "A command line tool for running JavaScript scripts that use the Asynchronous Module Definition API (AMD) for declaring and using JavaScript modules and regular JavaScript script files. It is part of the RequireJS project, and works with the RequireJS implementation of AMD." (from the r.js wiki summary)
- rstudio for questions related to RStudio use the rstudio tag. Don't use this tag just because you are working with RStudio.