R is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
for
statistical computing
Computational statistics, or statistical computing, is the bond between statistics and computer science. It means statistical methods that are enabled by using computational methods. It is the area of computational science (or scientific computin ...
and graphics supported by the R Core Team and the R Foundation for Statistical Computing. Created by statisticians
Ross Ihaka
George Ross Ihaka (born 1954) is a New Zealand statistician who was an Associate Professor of Statistics at the University of Auckland until his retirement in 2017. Alongside Robert Gentleman, he is one of the creators of the R programming lang ...
and
Robert Gentleman, R is used among
data miners,
bioinformaticians and
statistician
A statistician is a person who works with theoretical or applied statistics. The profession exists in both the private and public sectors.
It is common to combine statistical knowledge with expertise in other subjects, and statisticians may wor ...
s for
data analysis
Data analysis is a process of inspecting, cleansing, transforming, and modeling data with the goal of discovering useful information, informing conclusions, and supporting decision-making. Data analysis has multiple facets and approaches, enco ...
and developing
statistical software
Statistical software are specialized computer programs for analysis in statistics and econometrics.
Open-source
* ADaMSoft – a generalized statistical software with data mining algorithms and methods for data management
* ADMB – a software ...
. Users have created packages to augment the functions of the R language.
According to user surveys and studies of scholarly literature databases, R is one of the most commonly used programming languages used in data mining. R ranks 12th in the
TIOBE index
The TIOBE programming community index is a measure of popularity of programming languages, created and maintained by TIOBE Software BV, based in Eindhoven, the Netherlands. TIOBE stands for ''The Importance of Being Earnest'', the title of an 18 ...
, a measure of programming language popularity, in which the language peaked in 8th place in August 2020.
The official R software environment is an open-source
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, no ...
environment within the
GNU package
A number of notable software packages were developed for, or are maintained by, the Free Software Foundation as part of the GNU Project.
What it means to be a GNU package
Summarising the situation in 2013, Richard Stallman identified nine aspects ...
, available under the
GNU General Public License
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the Four Freedoms (Free software), four freedoms to run, study, share, and modify the software. The license was th ...
. It is written primarily in
C,
Fortran, and R itself (partially
self-hosting). Precompiled
executable
In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), instructi ...
s are provided for various
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s. R has a
command line interface
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
.
Multiple third-party
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s are also available, such as
RStudio
RStudio is an integrated development environment for R, a programming language for statistical computing and graphics. It is available in two formats: RStudio Desktop is a regular desktop application while RStudio Server runs on a remote server ...
, an
integrated development environment
An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
, and
Jupyter
Project Jupyter () is a project with goals to develop open-source software, open standards, and services for interactive computing across multiple programming languages. It was spun off from IPython in 2014 by Fernando Pérez and Brian Granger ...
, a
notebook interface
A notebook interface (also called a computational notebook) is a virtual notebook environment used for literate programming, a method of writing computer programs. Some notebooks are WYSIWYG environments including executable calculations embedded i ...
.
History
R is an open-source implementation of the
S programming language
S is a statistical programming language developed primarily by John Chambers and (in earlier versions) Rick Becker and Allan Wilks of Bell Laboratories. The aim of the language, as expressed by John Chambers, is "to turn ideas into software, quic ...
combined with
lexical scoping
In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts o ...
semantics from
Scheme A scheme is a systematic plan for the implementation of a certain idea.
Scheme or schemer may refer to:
Arts and entertainment
* ''The Scheme'' (TV series), a BBC Scotland documentary series
* The Scheme (band), an English pop band
* ''The Schem ...
, which allow objects to be defined in predetermined blocks rather than the entirety of the code.
S was created by Rick Becker,
John Chambers, Doug Dunn, Jean McRae, and Judy Schilling at
Bell Labs
Nokia Bell Labs, originally named Bell Telephone Laboratories (1925–1984),
then AT&T Bell Laboratories (1984–1996)
and Bell Labs Innovations (1996–2007),
is an American industrial research and scientific development company owned by mult ...
around 1976. Designed for statistical analysis, the language is an
interpreted language
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interprete ...
whose code could be directly run without a
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
. Many programs written for S run unaltered in R.
As a dialect of the
Lisp
A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech.
Types
* A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
language, Scheme was created by
Gerald J. Sussman and
Guy L. Steele Jr.
Guy Lewis Steele Jr. (; born October 2, 1954) is an American computer scientist who has played an important role in designing and documenting several computer programming languages and technical standards.
Biography
Steele was born in Missouri ...
at
MIT
The Massachusetts Institute of Technology (MIT) is a private land-grant research university in Cambridge, Massachusetts. Established in 1861, MIT has played a key role in the development of modern technology and science, and is one of the mo ...
around 1975.
In 1991, statisticians
Ross Ihaka
George Ross Ihaka (born 1954) is a New Zealand statistician who was an Associate Professor of Statistics at the University of Auckland until his retirement in 2017. Alongside Robert Gentleman, he is one of the creators of the R programming lang ...
and
Robert Gentleman at the
University of Auckland
, mottoeng = By natural ability and hard work
, established = 1883; years ago
, endowment = NZD $293 million (31 December 2021)
, budget = NZD $1.281 billion (31 December 2021)
, chancellor = Cecilia Tarrant
, vice_chancellor = Dawn F ...
, New Zealand, embarked on an S implementation. It was named partly after the first names of the first two R authors and partly as a play on the name of S.
They began publicizing it on the data archive StatLib and the ''s-news'' mailing list in August 1993.
In 1995, statistician Martin Mächler convinced Ihaka and Gentleman to make R
free and open-source software
Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
under the
GNU General Public License
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the Four Freedoms (Free software), four freedoms to run, study, share, and modify the software. The license was th ...
.
The first official release came in June 1995.
The first official
"stable beta" version (v1.0) was released on 29 February 2000.
The
Comprehensive R Archive Network
R packages are extensions to the R statistical programming language. R packages contain code, data, and documentation in a standardised collection format that can be installed by users of R, typically via a centralised software repository such as ...
(CRAN) was officially announced on 23 April 1997. CRAN stores R's executable files, source code, documentations, as well as packages contributed by users. CRAN originally had 3 mirrors and 12 contributed packages. As of January 2022, it has 101 mirrors
and 18,728 contributed packages. In addition to hosting packages CRAN hosts binaries for major distributions of Linux, MacOS and Windows.
The R Core Team was formed in 1997 to further develop the language.
, it consists of Chambers, Gentleman, Ihaka, and Mächler, plus statisticians Douglas Bates,
Peter Dalgaard
Peter may refer to:
People
* List of people named Peter, a list of people and fictional characters with the given name
* Peter (given name)
** Saint Peter (died 60s), apostle of Jesus, leader of the early Christian Church
* Peter (surname), a su ...
,
Kurt Hornik, Michael Lawrence, Friedrich Leisch, Uwe Ligges,
Thomas Lumley, Sebastian Meyer, Paul Murrell, Martyn Plummer,
Brian Ripley, Deepayan Sarkar, Duncan Temple Lang,
Luke Tierney, and Simon Urbanek, as well as computer scientist Tomas Kalibera. Stefano Iacus, Guido Masarotto, Heiner Schwarte, Seth Falcon, Martin Morgan, and Duncan Murdoch were members.
In April 2003, the R Foundation was founded as a non-profit organization to provide further support for the R project.
Features
Data processing
R's
data structure
In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
s include
vectors,
arrays
An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:
{{TOC right
Music
* In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
,
lists
A ''list'' is any set of items in a row. List or lists may also refer to:
People
* List (surname)
Organizations
* List College, an undergraduate division of the Jewish Theological Seminary of America
* SC Germania List, German rugby unio ...
, and data frames.
[
] Vectors are ordered collections of values and can be mapped to arrays of one or more dimensions in a
column major order. That is, given an ordered collection of dimensions, one fills in values along the first dimension first, then fill in one-dimensional arrays across the second dimension, and so on. R supports array arithmetics and in this regard is like languages such as
APL and
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
.
The special case of an array with two dimensions is called a
matrix
Matrix most commonly refers to:
* ''The Matrix'' (franchise), an American media franchise
** ''The Matrix'', a 1999 science-fiction action film
** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
. Lists serve as collections of objects that do not necessarily have the same
data type
In computer science and computer programming, a data type (or simply type) is a set of possible values and a set of allowed operations on it. A data type tells the compiler or interpreter how the programmer intends to use the data. Most progra ...
. Data frames contain a list of vectors of the same length, plus a unique set of row names.
R has no
scalar
Scalar may refer to:
*Scalar (mathematics), an element of a field, which is used to define a vector space, usually the field of real numbers
* Scalar (physics), a physical quantity that can be described by a single element of a number field such ...
data type. Instead, a scalar is represented as a length-one vector.
R and its libraries implement various statistical techniques, including
linear
Linearity is the property of a mathematical relationship (''function'') that can be graphically represented as a straight line. Linearity is closely related to '' proportionality''. Examples in physics include rectilinear motion, the linear r ...
,
generalized linear and
nonlinear
In mathematics and science, a nonlinear system is a system in which the change of the output is not proportional to the change of the input. Nonlinear problems are of interest to engineers, biologists, physicists, mathematicians, and many other ...
modeling, classical
statistical tests
A statistical hypothesis test is a method of statistical inference used to decide whether the data at hand sufficiently support a particular hypothesis.
Hypothesis testing allows us to make probabilistic statements about population parameters.
...
,
spatial and
time-series analysis
In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. Exa ...
, classification,
clustering, and others. For computationally intensive tasks,
C,
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, and
Fortran code can be
linked and called at run time. Another of R's strengths is static
graphics
Graphics () are visual images or designs on some surface, such as a wall, canvas, screen, paper, or stone, to inform, illustrate, or entertain. In contemporary usage, it includes a pictorial representation of data, as in design and manufacture ...
; it can produce publication-quality graphs that include mathematical symbols.
Programming
R is an
interpreted language
In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interprete ...
; users can access it through a
command-line interpreter
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
. If a user types
2+2
at the R command prompt and presses enter, the computer replies with
4
.
R supports
procedural programming
Procedural programming is a programming paradigm, derived from imperative programming, based on the concept of the ''procedure call''. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried ...
with
functions and, for some functions,
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
with
generic function
In computer programming, a generic function is a function defined for polymorphism.
In statically typed languages
In statically typed languages (such as C++ and Java), the term ''generic functions'' refers to a mechanism for ''compile-time pol ...
s. Due to its
S heritage, R has stronger
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
facilities than most statistical computing languages. Extending it is facilitated by its
lexical scoping
In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts o ...
rules, which are derived from Scheme. R uses
S-expressions
In computer programming, an S-expression (or symbolic expression, abbreviated as sexpr or sexp) is an expression in a like-named notation for nested list (tree-structured) data. S-expressions were invented for and popularized by the programming la ...
to represent both data and code. R's extensible object system includes objects for (among others):
regression models
Regression or regressions may refer to:
Science
* Marine regression, coastal advance due to falling sea level, the opposite of marine transgression
* Regression (medicine), a characteristic of diseases to express lighter symptoms or less extent ( ...
,
time-series
In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. Exa ...
and
geo-spatial coordinates. Advanced users can write C, C++,
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
,
.NET or
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
code to manipulate R objects directly.
Functions are
first-class objects and can be manipulated in the same way as data objects, facilitating
meta-programming
Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
that allows
multiple dispatch
Multiple dispatch or multimethods is a feature of some programming languages in which a function or method can be dynamically dispatched based on the run-time (dynamic) type or, in the more general case, some other attribute of more than one of ...
. Function arguments are passed by value, and are
lazy—that is to say, they are only evaluated when they are used, not when the function is called. A generic function acts differently depending on the
classes of the arguments passed to it. In other words, the generic function
dispatches the
method
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
implementation specific to that object's
class
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differentl ...
. For example, R has a
generic
Generic or generics may refer to:
In business
* Generic term, a common name used for a range or class of similar things not protected by trademark
* Generic brand, a brand for a product that does not have an associated brand or trademark, other ...
print
function that can print almost every
class
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differentl ...
of
object
Object may refer to:
General meanings
* Object (philosophy), a thing, being, or concept
** Object (abstract), an object which does not exist at any particular time or place
** Physical object, an identifiable collection of matter
* Goal, an ai ...
in R with
print(objectname)
.
Many of R's standard functions are written in R, which makes it easy for users to follow the algorithmic choices made. R is highly extensible through the use of packages for specific functions and specific applications.
Packages
R's capabilities are extended through user-created ''packages'', which offer statistical techniques, graphical devices, import/export, reporting (
RMarkdown,
knitr
knitr is an engine for dynamic report generation with R. It is a package in the programming language R that enables integration of R code into LaTeX, LyX, HTML, Markdown, AsciiDoc, and reStructuredText documents. The purpose of knitr is to allow ...
,
Sweave Sweave is a function in the statistical programming language R that enables integration of R code into LaTeX or LyX documents. The purpose is "to create dynamic reports, which can be updated automatically if data or analysis change".
The data an ...
), etc. These packages and their easy installation and use has been cited as driving the language's widespread adoption in
data science
Data science is an interdisciplinary field that uses scientific methods, processes, algorithms and systems to extract or extrapolate knowledge and insights from noisy, structured and unstructured data, and apply knowledge from data across a br ...
.
The packaging system is also used by researchers to organize research data, code and report files in a systematic way for sharing and archiving.
Multiple packages are included with the basic installation. Additional packages are available on CRAN,
Bioconductor
Bioconductor is a Free software, free, Open-source software, open source and Open source software development, open development software project for the analysis and comprehension of Genome, genomic data generated by Wet laboratory, wet lab experi ...
, R-Forge,
Omegahat,
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
, and other repositories.
The "Task Views" on the CRAN website
lists packages in fields including Finance, Genetics, High Performance Computing, Machine Learning, Medical Imaging,
Meta-Analysis
A meta-analysis is a statistical analysis that combines the results of multiple scientific studies. Meta-analyses can be performed when there are multiple scientific studies addressing the same question, with each individual study reporting me ...
,
Social Sciences and Spatial Statistics.
R has been identified by the
FDA
The United States Food and Drug Administration (FDA or US FDA) is a federal agency of the Department of Health and Human Services. The FDA is responsible for protecting and promoting public health through the control and supervision of food s ...
as suitable for interpreting data from clinical research. Microsoft maintains a daily snapshot of CRAN that dates back to Sept. 17, 2014.
Other R package resources include R-Forge,
a platform for the collaborative development of R packages. The Bioconductor project provides packages for genomic data analysis, including object-oriented data-handling and analysis tools for data from
Affymetrix
Affymetrix is now Applied Biosystems, a brand of DNA microarray products sold by Thermo Fisher Scientific that originated with an American biotechnology research and development and manufacturing company of the same name. The Santa Clara, Califor ...
,
cDNA
In genetics, complementary DNA (cDNA) is DNA synthesized from a single-stranded RNA (e.g., messenger RNA (mRNA) or microRNA (miRNA)) template in a reaction catalyzed by the enzyme reverse transcriptase. cDNA is often used to express a speci ...
microarray
A microarray is a multiplex lab-on-a-chip. Its purpose is to simultaneously detect the expression of thousands of genes from a sample (e.g. from a tissue). It is a two-dimensional array on a solid substrate—usually a glass slide or silicon t ...
, and next-generation
high-throughput sequencing
DNA sequencing is the process of determining the nucleic acid sequence – the order of nucleotides in DNA. It includes any method or technology that is used to determine the order of the four bases: adenine, guanine, cytosine, and thymine. The ...
methods.
A group of packages called the
Tidyverse
The tidyverse is a collection of open source packages for the R programming language introduced by Hadley Wickham and his team that "share an underlying design philosophy, grammar, and data structures" of tidy data. Characteristic features of tidy ...
, which can be considered a "dialect" of the R language, is increasingly popular among developers.
[Metacran]
listed 7 of the 8 core packages of the Tidyverse in the list of most download R packages. It strives to provide a cohesive collection of functions to deal with common data science tasks, including data import, cleaning, transformation and visualisation (notably with the
ggplot2
ggplot2 is an open-source data visualization R package, package for the Computational statistics, statistical programming language R (programming language), R. Created by Hadley Wickham in 2005, ggplot2 is an implementation of Leland Wilkinson' ...
package). Dynamic and interactive graphics are available through additional packages.
R is one of 5 languages with an
Apache Spark
Apache Spark is an open-source unified analytics engine for large-scale data processing. Spark provides an interface for programming clusters with implicit data parallelism and fault tolerance. Originally developed at the University of Californi ...
API, along with
Scala,
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
,
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
, and
SQL.
Milestones
A list of changes in R releases is maintained in various "news" files at CRAN.
[Changes in versions 3.0.0 onward:
Earlier change logs (by major release number):
*
*
*
*
*
] Some highlights are listed below for several major releases.
Interfaces
Various applications can be used to edit or run R code.
Early developers preferred to run R via the command line console,
succeeded by those who prefer an
IDE.
IDEs for R include (in alphabetical order
R.app(OSX/macOS only),
Rattle GUI
Rattle GUI is a free and open source software ( GNU GPL v2) package providing a graphical user interface (GUI) for data mining using the R statistical programming language. Rattle is used in a variety of situations. Currently there are 15 differ ...
,
R Commander
R Commander (Rcmdr) is a GUI for the R programming language, licensed under the GNU General Public License, and developed and maintained by John Fox in the sociology department at McMaster University. Rcmdr looks and works similarly to SPSS GUI ...
,
RKWard
RKWard is a transparent front-end to the R programming language, a scripting-language with a strong focus on statistics functions. RKWard tries to combine the power of the R language with the ease of use of commercial statistical packages.
RKWa ...
,
RStudio
RStudio is an integrated development environment for R, a programming language for statistical computing and graphics. It is available in two formats: RStudio Desktop is a regular desktop application while RStudio Server runs on a remote server ...
, and Tinn-R.
R is also supported in multi-purpose IDEs such as
Eclipse
An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ce ...
via the StatET plugin, and
Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
via the
R Tools for Visual Studio
R Tools for Visual Studio (RTVS) is a plug-in for the Microsoft Visual Studio integrated development environment (IDE), used to provide support for programming in the language R. It supports IntelliSense, debugging, plotting, remote execution, ...
. Of these, RStudio is the most commonly used.
Statistical frameworks which use R in the background include
Jamovi
Jamovi (stylized in all lower-case as jamovi) is a free and open-source computer program for data analysis and performing statistical tests. The core developers of Jamovi are Jonathon Love, Damian Dropmann, and Ravi Selker who are developers for ...
and
JASP
JASP (Jeffreys’s Amazing Statistics Program) is a free and open-source program for statistical analysis supported by the University of Amsterdam. It is designed to be easy to use, and familiar to users of SPSS. It offers standard analysis proce ...
.
Editors that support R include
Emacs
Emacs , originally named EMACS (an acronym for "Editor MACroS"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, s ...
,
Vim (Nvim-R plugin),
Kate Kate name may refer to:
People and fictional characters
* Kate (given name), a list of people and fictional characters with the given name or nickname
* Gyula Káté (born 1982), Hungarian amateur boxer
* Lauren Kate (born 1981), American autho ...
,
LyX
LyX (styled as ; pronounced ) (Based on 3 developers, they say it can be pronounced "Licks", "Lucks" and "Leeks") is an open source, graphical user interface document processor based on the LaTeX typesetting system. Unlike most word processors, ...
,
Notepad++
Notepad++ is a text and source code editor for use with Microsoft Windows. It supports tabbed editing, which allows working with multiple open files in a single window. The product's name comes from the C postfix increment operator.
Notepad++ ...
,
Visual Studio Code
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft with the Electron Framework, for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code complet ...
,
WinEdt
WinEdt is a shareware Unicode (UTF-8) editor and shell for Microsoft Windows. It is primarily used for the creation of TeX (or LaTeX) documents, but can also be used to edit HTML or any other type of text file. It can be configured to run as a fro ...
, and Tinn-R.
Jupyter Notebook
Project Jupyter () is a project with goals to develop open-source software, open standards, and services for interactive computing across multiple programming languages. It was spun off from IPython in 2014 by Fernando Pérez and Brian Granger ...
can also be configured to edit and run R code.
R functionality is accessible from scripting languages including
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
,
Perl
Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
,
Ruby
A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sa ...
,
F#, and
Julia
Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g. ...
. Interfaces to other, high-level programming languages, like
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
and
.NET C# are available.
Implementations
The main R implementation is written in R, C, and Fortran. Several other implementations aimed at improving speed or increasing extensibility. A closely related implementation is pqR (pretty quick R) by
Radford M. Neal
Radford M. Neal is a professor at the Department of Statistics and Department of Computer Science at the University of Toronto, where he holds a research chair in statistics and machine learning. He studied computer science at the University of C ...
with improved memory management and support for automatic multithreading.
Renjin
Renjin is an implementation of the R (programming language), R programming language atop the Java Virtual Machine. It is free software released under the GNU General Public License, GPL. Renjin is tightly integrated with Java (programming languag ...
and FastR are
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
implementations of R for use in a
Java Virtual Machine
A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
. CXXR, rho, and Riposte are implementations of R in
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
.
Renjin
Renjin is an implementation of the R (programming language), R programming language atop the Java Virtual Machine. It is free software released under the GNU General Public License, GPL. Renjin is tightly integrated with Java (programming languag ...
,
Riposte
In fencing, a riposte ( French for "retort") is an offensive action with the intent of hitting one's opponent made by the fencer who has just parried an attack. In military usage, a riposte is the strategic device of hitting a vulnerable point o ...
, and pqR attempt to improve performance by using multiple cores and deferred evaluation. Most of these alternative implementations are experimental and incomplete, with relatively few users, compared to the main implementation maintained by the R Development Core Team.
TIBCO
TIBCO Software Inc. is an American business intelligence software company founded in 1997 in Palo Alto, California.
It has headquarters in Palo Alto, California, and offices in North America, Europe, Asia, the Middle East, Africa and South A ...
, who previous sold the commercial implementation
S-PLUS
S-PLUS is a commercial implementation of the S programming language sold by TIBCO Software Inc.
It features object-oriented programming capabilities and advanced analytical algorithms.
Due to the increasing popularity of the open source S succ ...
, built a
runtime engine
In computer programming, a runtime system or runtime environment is a sub-system that exists both in the computer where a program is created, as well as in the computers where the program is intended to be run. The name comes from the compile t ...
called TERR, which is part of
Spotfire
TIBCO Spotfire is an artificial intelligence (AI)-based analytics platform. Before being acquired by TIBCO in 2007, Spotfire was a business intelligence company based in Somerville, Massachusetts.
History
Spotfire was founded by Christopher Ahlb ...
.
Microsoft R Open (MRO) is a fully compatible R distribution with modifications for multi-threaded computations. As of 30 June 2021, Microsoft started to phase out MRO in favor of the CRAN distribution.
Communities
R has local communities worldwide for users to network, share ideas, and learn.
A growing number of R events bring users together, such as conferences (e.g.
useR!, WhyR?, conectaR, SatRdays), meetups, as well as
R-Ladies groups that promote
gender diversity
Gender diversity is equitable or fair representation of people of different genders. It most commonly refers to an equitable ratio of men and women, but may also include people of non-binary genders. Gender diversity on corporate boards has bee ...
. The R Foundation taskforce focuses on women and other under-represented groups.
useR! conferences
The official annual gathering of R users is called "useR!".
The first such event was useR! 2004 in May 2004,
Vienna
en, Viennese
, iso_code = AT-9
, registration_plate = W
, postal_code_type = Postal code
, postal_code =
, timezone = CET
, utc_offset = +1
, timezone_DST ...
, Austria. After skipping 2005, the useR! conference has been held annually, usually alternating between locations in Europe and North America. History:
* useR! 2006, Vienna, Austria
* useR! 2007, Ames, Iowa, US
* useR! 2008, Dortmund, Germany
* useR! 2009, Rennes, France
* useR! 2010, Gaithersburg, Maryland, US
* useR! 2011, Coventry, United Kingdom
* useR! 2012, Nashville, Tennessee, US
* useR! 2013, Albacete, Spain
* useR! 2014, Los Angeles, California, US
* useR! 2015, Aalborg, Denmark
* useR! 2016, Stanford, California, US
* useR! 2017, Brussels, Belgium
* useR! 2018, Brisbane, Australia
* useR! 2019, Toulouse, France
* useR! 2020, took place online due to COVID-19 pandemic
* useR! 2021, took place online due to COVID-19 pandemic
* useR! 2022, took place online due to COVID-19 pandemic
The dates and the location for the next useR! event is to be decided as of end of 2022.
''The R Journal''
''
The R Journal
''The R Journal'' is a peer-reviewed open-access scientific journal published by The R Foundation since 2009. It publishes research articles in statistical computing that are of interest to users of the R programming language. The journal includes ...
'' is an
open access
Open access (OA) is a set of principles and a range of practices through which research outputs are distributed online, free of access charges or other barriers. With open access strictly defined (according to the 2001 definition), or libre op ...
,
refereed journal of the R project. It features short to medium length articles on the use and development of R, including packages, programming tips, CRAN news, and foundation news.
Comparison with alternatives
R is comparable to popular commercial statistical packages such as
SAS,
SPSS
SPSS Statistics is a statistical software suite developed by IBM for data management, advanced analytics, multivariate analysis, business intelligence, and criminal investigation. Long produced by SPSS Inc., it was acquired by IBM in 2009. C ...
, and
Stata
Stata (, , alternatively , occasionally stylized as STATA) is a general-purpose statistical software package developed by StataCorp for data manipulation, visualization, statistics, and automated reporting. It is used by researchers in many fie ...
. One difference is that R is available at no charge under a
free software license
A free-software license is a notice that grants the recipient of a piece of software extensive rights to modify and redistribute that software. These actions are usually prohibited by copyright law, but the rights-holder (usually the author) ...
.
In January 2009, the ''
New York Times
''The New York Times'' (''the Times'', ''NYT'', or the Gray Lady) is a daily newspaper based in New York City with a worldwide readership reported in 2020 to comprise a declining 840,000 paid print subscribers, and a growing 6 million paid d ...
'' ran an article charting the growth of R, the reasons for its popularity among data scientists and the threat it poses to commercial statistical packages such as SAS. In June 2017 data scientist Robert Muenchen published a more in-depth comparison between R and other software packages, "The Popularity of Data Science Software".
R is more procedural than either SAS or SPSS, both of which make heavy use of pre-programmed procedures (called "procs") that are built-in to the language environment and customized by parameters of each call. R generally processes data in-memory, which limits its usefulness in processing larger files.
Commercial support
Although R is an
open-source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
project, some companies provide commercial support and extensions.
In 2007, Richard Schultz, Martin Schultz, Steve Weston and Kirk Mettler founded
Revolution Analytics
Revolution Analytics (formerly REvolution Computing) is a statistical software company focused on developing open source and "open-core" versions of the free and open source software R for enterprise, academic and analytics customers. Revolution ...
to provide commercial support for Revolution R, their distribution of R, which includes components developed by the company. Major additional components include: ParallelR, the R Productivity Environment IDE, RevoScaleR (for
big data
Though used sometimes loosely partly because of a lack of formal definition, the interpretation that seems to best describe Big data is the one associated with large body of information that we could not comprehend when used only in smaller am ...
analysis), RevoDeployR, web services framework, and the ability for reading and writing data in the SAS file format.
[Morgan, Timothy Prickett (2011-02-07). "'Red Hat for stats' goes toe-to-toe with SAS". The Register, 7 February 2011. Retrieved from https://www.theregister.co.uk/2011/02/07/revolution_r_sas_challenge/.] Revolution Analytics offers an R distribution designed to comply with established
IQ/OQ/PQ criteria that enables clients in the pharmaceutical sector to validate their installation of REvolution R. In 2015,
Microsoft Corporation
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
acquired Revolution Analytics
and integrated the R programming language into
SQL Server,
Power BI
Power BI is an interactive data visualization software product developed by Microsoft with a primary focus on business intelligence. It is part of the Microsoft Power Platform.
Power BI is a collection of software services, apps, and connectors t ...
,
Azure SQL Managed Instance
Microsoft Azure, often referred to as Azure ( , ), is a cloud computing platform operated by Microsoft for application management via around the world-distributed data centers. Microsoft Azure has multiple capabilities such as software as a ...
,
Azure Cortana Intelligence
Microsoft Azure, often referred to as Azure ( , ), is a cloud computing platform operated by Microsoft for application management via around the world-distributed data centers. Microsoft Azure has multiple capabilities such as software as a ...
, Microsoft ML Server and
Visual Studio 2017
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
.
In October 2011,
Oracle
An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination.
Description
The word '' ...
announced the ''Big Data Appliance'', which integrates R,
Apache Hadoop
Apache Hadoop () is a collection of open-source software utilities that facilitates using a network of many computers to solve problems involving massive amounts of data and computation. It provides a software framework for distributed storage ...
,
Oracle Linux
Oracle Linux (abbreviated OL, formerly known as Oracle Enterprise Linux or OEL) is a Linux distribution packaged and freely distributed by Oracle, available partially under the GNU General Public License since late 2006. It is compiled from Red ...
, and a
NoSQL
A NoSQL (originally referring to "non- SQL" or "non-relational") database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. Such databases have existed ...
database with
Exadata
The Oracle Exadata Database Machine (Exadata) is a computing platform optimized for running Oracle Databases.
Exadata is a combined hardware and software platform that includes scale-out Intel x86-64 compute and storage servers, RoCE or Infini ...
hardware. ,
Oracle R Enterprise
Oracle Database (commonly referred to as Oracle DBMS, Oracle Autonomous Database, or simply as Oracle) is a multi-model database, multi-model database management system produced and marketed by Oracle Corporation.
It is a database commonly used ...
[Chris Kanaracus (2012)]
''Oracle Stakes Claim in R With Advanced Analytics Launch''
PC World, February 8, 2012. became one of two components of the "Oracle Advanced Analytics Option"
[Doug Henschen (2012)]
''Oracle Stakes Claim in R With Advanced Analytics Launch''
InformationWeek, April 4, 2012. (alongside
Oracle Data Mining Oracle Data Mining (ODM) is an option of Oracle Database Enterprise Edition. It contains several data mining and data analysis algorithms for classification, prediction, regression, associations, feature selection, anomaly detection, feature ...
).
IBM offers support for in-
Hadoop
Apache Hadoop () is a collection of open-source software utilities that facilitates using a network of many computers to solve problems involving massive amounts of data and computation. It provides a software framework for distributed storage an ...
execution of R, and provides a programming model for massively parallel in-database analytics in R.
TIBCO
TIBCO Software Inc. is an American business intelligence software company founded in 1997 in Palo Alto, California.
It has headquarters in Palo Alto, California, and offices in North America, Europe, Asia, the Middle East, Africa and South A ...
offers a runtime-version R as a part of
Spotfire
TIBCO Spotfire is an artificial intelligence (AI)-based analytics platform. Before being acquired by TIBCO in 2007, Spotfire was a business intelligence company based in Somerville, Massachusetts.
History
Spotfire was founded by Christopher Ahlb ...
.
Mango Solutions offers a validation package for R, ValidR, to comply with drug approval agencies, such as the FDA. These agencies required the use of validated software, as attested by the vendor or sponsor.
Examples
Basic syntax
The following examples illustrate the basic
syntax of the language and use of the command-line interface. (An expanded list of standard language features can be found in the R manual, "An Introduction to R".)
In R, the generally preferred
assignment operator
Assignment, assign or The Assignment may refer to:
* Homework
* Sex assignment
* The process of sending National Basketball Association players to its development league; see
Computing
* Assignment (computer science), a type of modification to ...
is an arrow made from two characters
<-
, although
=
can be used in some cases.
> x <- 1:6 # Create a numeric vector in the current environment
> y <- x^2 # Create vector based on the values in x.
> print(y) # Print the vector’s contents.
1 4 9 16 25 36
> z <- x + y # Create a new vector that is the sum of x and y
> z # Return the contents of z to the current environment.
2 6 12 20 30 42
> z_matrix <- matrix(z, nrow=3) # Create a new matrix that turns the vector z into a 3x2 matrix object
> z_matrix
1 2 , 2 20
, 6 30
, 12 42
> 2*t(z_matrix)-2 # Transpose the matrix, multiply every element by 2, subtract 2 from each element in the matrix, and return the results to the terminal.
1 2 3 , 2 10 22
, 38 58 82
> new_df <- data.frame(t(z_matrix), row.names=c('A','B')) # Create a new data.frame object that contains the data from a transposed z_matrix, with row names 'A' and 'B'
> names(new_df) <- c('X','Y','Z') # Set the column names of new_df as X, Y, and Z.
> print(new_df) # Print the current results.
X Y Z
A 2 6 12
B 20 30 42
> new_df$Z # Output the Z column
12 42
> new_df$Znew_df Z'&& new_df /h1>new_df$Z # The data.frame column Z can be accessed using $Z, Z' or syntax, and the values are the same.
TRUE
> attributes(new_df) # Print attributes information about the new_df object
$names
"X" "Y" "Z"
$row.names
"A" "B"
$class
"data.frame"
> attributes(new_df)$row.names <- c('one','two') # Access and then change the row.names attribute; can also be done using rownames()
> new_df
X Y Z
one 2 6 12
two 20 30 42
Structure of a function
One of R's strengths is the ease of creating new functions. Objects in the function body remain local to the function, and any data type may be returned.
Example:
# Declare function “f” with parameters “x”, “y“
# that returns a linear combination of x and y.
f <- function(x, y)
> f(1, 2)
11
> f(c(1,2,3), c(5,3,4))
23 18 25
> f(1:3, 4)
19 22 25
Modeling and plotting
The R language has built-in support for data modeling and graphics. The following example shows how R can easily generate and plot a linear model with residuals.
> x <- 1:6 # Create x and y values
> y <- x^2
> model <- lm(y ~ x) # Linear regression model y = A + B * x.
> summary(model) # Display an in-depth summary of the model.
Call:
lm(formula = y ~ x)
Residuals:
1 2 3 4 5 6 7 8 9 10
3.3333 -0.6667 -2.6667 -2.6667 -0.6667 3.3333
Coefficients:
Estimate Std. Error t value Pr(>, t, )
(Intercept) -9.3333 2.8441 -3.282 0.030453 *
x 7.0000 0.7303 9.585 0.000662 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.055 on 4 degrees of freedom
Multiple R-squared: 0.9583, Adjusted R-squared: 0.9478
F-statistic: 91.88 on 1 and 4 DF, p-value: 0.000662
> par(mfrow = c(2, 2)) # Create a 2 by 2 layout for figures.
> plot(model) # Output diagnostic plots of the model.
Mandelbrot set
Short R code calculating
Mandelbrot set
The Mandelbrot set () is the set of complex numbers c for which the function f_c(z)=z^2+c does not diverge to infinity when iterated from z=0, i.e., for which the sequence f_c(0), f_c(f_c(0)), etc., remains bounded in absolute value.
This ...
through the first 20 iterations of equation ''z'' = ''z''
2 + ''c'' plotted for different complex constants ''c''. This example demonstrates:
* use of community-developed external libraries (called packages), in this case caTools package
* handling of
complex numbers
In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the form a ...
* multidimensional arrays of numbers used as basic data type, see variables
C
,
Z
and
X
.
install.packages("caTools") # install external package
library(caTools) # external package providing write.gif function
jet.colors <- colorRampPalette(c("green", "pink", "#007FFF", "cyan", "#7FFF7F",
"white", "#FF7F00", "red", "#7F0000"))
dx <- 1500 # define width
dy <- 1400 # define height
C <- complex(real = rep(seq(-2.2, 1.0, length.out = dx), each = dy),
imag = rep(seq(-1.2, 1.2, length.out = dy), dx))
C <- matrix(C, dy, dx) # reshape as square matrix of complex numbers
Z <- 0 # initialize Z to zero
X <- array(0, c(dy, dx, 20)) # initialize output 3D array
for (k in 1:20)
write.gif(X, "Mandelbrot.gif", col = jet.colors, delay = 100)
See also
*
R package
R packages are extensions to the R statistical programming language. R packages contain code, data, and documentation in a standardised collection format that can be installed by users of R, typically via a centralised software repository such as ...
*
Comparison of numerical-analysis software
The following tables provide a comparison of numerical-analysis software.
Applications
General
Operating system support
The operating systems the software can run on natively (without emulation).
Language features
Colors indicate ...
*
Comparison of statistical packages
The following tables compare general and technical information for a number of statistical analysis packages.
General information
Operating system support
ANOVA
Support for various ANOVA methods
Regression
Support for various Regression an ...
*
List of numerical-analysis software
Listed here are notable end-user computer applications intended for use with numerical or data analysis:
Numerical-software packages
General-purpose computer algebra systems
Interface-oriented
Language-oriented
Historically significa ...
*
List of statistical software
Statistical software are specialized computer programs for analysis in statistics and econometrics.
Open-source
* ADaMSoft – a generalized statistical software with data mining algorithms and methods for data management
* ADMB – a software ...
*
Rmetrics
Notes
References
External links
* of the R project
R Technical Papers
{{Portal bar, Computer programming
Array programming languages
Cross-platform free software
Data mining and machine learning software
Data-centric programming languages
Dynamically typed programming languages
Free plotting software
Free statistical software
Functional languages
GNU Project software
Literate programming
Numerical analysis software for Linux
Numerical analysis software for macOS
Numerical analysis software for Windows
Programming languages created in 1993
Science software
Statistical programming languages
Articles with example R code