Overview of R

Site: Saylor Academy
Course: PRDV420: Introduction to R Programming
Book: Overview of R
Printed by: Guest user
Date: Thursday, May 16, 2024, 9:41 PM

Description

Read about R, its history, connections to other languages, and alternatives for statistical computing. You will also learn about various interfaces that can be used to edit and run R code, such as RStudio.

Introduction

R is a programming language for statistical computing and graphics supported by the R Core Team and the R Foundation for Statistical Computing. Created by statisticians Ross Ihaka and Robert Gentleman, R is used among data miners and statisticians for data analysis and developing statistical 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 in data mining. As of March 2022, R ranks 11th in the TIOBE index, a measure of programming language popularity.

The official R software environment is an open-source, free software within the GNU package, available under the GNU General Public License. It is written primarily in C, Fortran, and R (partially self-hosting). Precompiled executables are provided for various operating systems. R has a command-line interface. Multiple third-party graphical user interfaces, such as RStudio, an integrated development environment, and Jupyter, a notebook interface, are also available.


Source: V. Lyubchich, https://rpubs.com/vlyubchich/r_overview
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License.

History

R is an open-source implementation of the S programming language combined with lexical scoping semantics from Scheme, which allows 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 around 1976. Designed for statistical analysis, the language is an interpreted language whose code could be directly run without a compiler. Many programs written for S run unaltered in R. As a dialect of the Lisp language, Scheme was created by Gerald J. Sussman and Guy L. Steele Jr. at MIT around 1975.

In 1991, statisticians Ross Ihaka and Robert Gentleman at the University of Auckland, 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 a free and open-source software under the GNU General Public License. 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 (CRAN) was officially announced on 23 April 1997. CRAN stores R's executable files, source code, documentation, as well as packages contributed by users. CRAN originally had three mirrors and 12 contributed packages. As of January 2022, it has 101 mirrors and 18,728 contributed packages.

The R Core Team was formed in 1997 to develop the language further. As of January 2022, it consists of Chambers, Gentleman, Ihaka, and Mächler, plus statisticians Douglas Bates, Peter Dalgaard, 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 structures include vectors, arrays, lists, and data frames. Vectors are ordered collections of values and can be mapped to arrays of one or more dimensions in a column's major order. That is, given an ordered collection of dimensions, one fills in values along the first dimension first, then fills 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. The special case of an array with two dimensions is called a matrix. Lists serve as collections of objects that do not necessarily have the same data type. Data frames contain a list of vectors of the same length plus a unique set of row names. R has no scalar data type. Instead, a scalar is represented as a length-one vector.

R and its libraries implement various statistical techniques, including linear and nonlinear modeling, classical statistical tests, spatial and time-series analysis, classification, clustering, and others. C, C++, and Fortran code can be linked and called at run time for computationally intensive tasks. Another of R's strengths is static graphics; it can produce publication-quality graphs that include mathematical symbols.


Programming

R is an interpreted language; users can access it through a command-line interpreter. If a user types 2+2 at the R command prompt and presses enter, the computer replies with 4.

R supports procedural programming with functions and, for some functions, object-oriented programming with generic functions. Due to its S heritage, R has stronger object-oriented programming facilities than most statistical computing languages. Extending it is facilitated by its lexical scoping rules derived from Scheme. R uses S-expressions to represent both data and code. R's extensible object system includes objects for (among others): regression models, time series, and geospatial coordinates. Advanced users can write C, C++, Java, .NET, or Python code to manipulate R objects directly.

Functions are first-class objects and can be manipulated similarly to data objects, facilitating meta-programming that allows multiple dispatches. 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 implementation specific to that object's class. For example, R has a generic print function that can print almost every class of object in R with print(objectname). Many of R's standard functions are written in R, making it easy for users to follow the algorithmic choices. 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, Sweave), etc. R's packages and the ease of installing and using them have been cited as driving the language's widespread adoption in data science. The packaging system is also used by researchers to create compendia 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, Omegahat, GitHub, and other repositories.

The "Task Views" on the CRAN website list packages in fields including Finance, Genetics, High-Performance Computing, Machine Learning, Medical Imaging, Social Sciences, and Spatial Statistics. The FDA has identified R as suitable for interpreting data from clinical research. Microsoft maintains a daily snapshot of CRAN dating 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, cDNA microarray, and next-generation high-throughput sequencing methods.

A group of packages called the Tidyverse, considered a "dialect" of the R language, is increasingly popular among developers. It strives to provide a cohesive collection of functions to deal with common data science tasks, including data import, cleaning, transformation, and visualization (notably with the ggplot2 package). Dynamic and interactive graphics are available through additional packages.text

R is one of 5 languages with an Apache Spark API, along with Scala, Java, Python, and SQL.

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 preferred an IDE. IDEs for R include (in alphabetical order) Rattle GUI, R Commander, RKWard, RStudio, and Tinn-R. R is also supported in multi-purpose IDEs such as Eclipse via the StatET plugin and Visual Studio via the R Tools for Visual Studio. Of these, RStudio is the most commonly used.

Editors that support R include Emacs, Vim (Nvim-R plugin), Kate, LyX, Notepad++, Visual Studio Code, WinEdt, and Tinn-R. The Jupyter Notebook can also be configured to edit and run R code.

R functionality is accessible from scripting languages, including Python, Perl, Ruby, F#, and Julia. Interfaces to other high-level programming languages, like Java and .NET C#, are available.

Implementations

The main R implementation is written in R, C, and Fortran. Several other implementations are aimed at improving speed or increasing extensibility. A closely related implementation is pqR (pretty quick R) by Radford M. Neal, with improved memory management and support for automatic multithreading. Renjin and FastR are Java implementations of R for use in a Java Virtual Machine. CXXR, rho, and Riposte are implementations of R in C++. Renjin, Riposte, 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, who previously sold the commercial implementation S-PLUS, built a runtime engine called TERR, which is part of Spotfire.

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.

Comparision with Alternatives

R is comparable to popular commercial statistical packages such as SAS, SPSS, and Stata. One difference is that R is available at no charge under a free software license.

In January 2009, the New York Times 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 into the language environment and customized by the parameters of each call. R generally processes data in memory, which limits its usefulness in processing larger files.

Commercial Support

Although R is open-source, some companies provide commercial support and extensions.

In 2007, Richard Schultz, Martin Schultz, Steve Weston, and Kirk Mettler founded Revolution Analytics 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 analysis), RevoDeployR, web services framework, and the ability to read and write data in the SAS file format. 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 acquired Revolution Analytics and integrated the R programming language into SQL Server, Power BI, Azure SQL Managed Instance, Azure Cortana Intelligence, Microsoft ML Server and Visual Studio 2017.text

In October 2011, Oracle announced the Big Data Appliance, which integrates R, Apache Hadoop, Oracle Linux, and a NoSQL database with Exadata hardware. As of 2012, Oracle R Enterprise became one of two components of the "Oracle Advanced Analytics Option" (alongside Oracle Data Mining).

IBM offers support for in-Hadoop execution of R and provides a programming model for massively parallel in-database analytics in R.

TIBCO offers a runtime-version R as a part of Spotfire.

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.