WIKI R (Programming Language)
WIKI R (Programming Language)
R is a programming language and software environment Another strength of R is static graphics, which can pro-
for statistical computing and graphics supported by the R duce publication-quality graphs, including mathematical
Foundation for Statistical Computing.[3] The R language symbols. Dynamic and interactive graphics are available
is widely used among statisticians and data miners for de- through additional packages.[16]
veloping statistical software[4] and data analysis.[5] Polls,
R has its own LaTeX-like documentation format, which
surveys of data miners, and studies of scholarly literature is used to supply comprehensive documentation, both on-
databases show that R’s popularity has increased substan- line in a number of formats and in hard copy.
tially in recent years.[6]
R is an implementation of the S programming language
combined with lexical scoping semantics inspired by
Scheme.[7] S was created by John Chambers while at Bell 2 Programming features of R
Labs. There are some important differences, but much of
the code written for S runs unaltered.
R is an interpreted language; users typically access it
R was created by Ross Ihaka and Robert Gentleman[8] through a command-line interpreter. If a user types 2+2
at the University of Auckland, New Zealand, and is cur- at the R command prompt and presses enter, the com-
rently developed by the R Development Core Team, of puter replies with 4, as shown below:
which Chambers is a member. R is named partly after
the first names of the first two R authors and partly as a > 2+2 [1] 4
play on the name of S.[9]
R is a GNU project.[10] The source code for the R soft- Like other similar languages such as APL and MATLAB,
ware environment is written primarily in C, Fortran, and R supports matrix arithmetic. R’s data structures include
R.[11] R is freely available under the GNU General Public vectors, matrices, arrays, data frames (similar to tables in
License, and pre-compiled binary versions are provided a relational database) and lists.[17] R’s extensible object
for various operating systems. While R has a command system includes objects for (among others): regression
line interface, there are several graphical front-ends avail- models, time-series and geo-spatial coordinates. The
able. scalar data type was never a data structure of R.[18] In-
stead, a scalar is represented as a vector with length one.
R supports procedural programming with functions and,
1 Statistical features for some functions, object-oriented programming with
generic functions. A generic function acts differently
depending on the type of arguments passed to it. In
R and its libraries implement a wide variety of statistical other words, the generic function dispatches the function
and graphical techniques, including linear and nonlinear (method) specific to that type of object. For example, R
modeling, classical statistical tests, time-series analysis, has a generic print function that can print almost every
classification, clustering, and others. R is easily extensi- type of object in R with a simple print(objectname) syn-
ble through functions and extensions, and the R commu- tax.
nity is noted for its active contributions in terms of pack-
ages. Many of R’s standard functions are written in R it- Although used mainly by statisticians and other prac-
self, which makes it easy for users to follow the algorith- titioners requiring an environment for statistical com-
mic choices made. For computationally intensive tasks, putation and software development, R can also oper-
C, C++, and Fortran code can be linked and called at ate as a general matrix calculation toolbox – with per-
run time. Advanced users can write C, C++,[12] Java,[13] formance benchmarks comparable to GNU Octave or
.NET[14] or Python code to manipulate R objects directly. MATLAB.[19] Arrays are stored in column-major or-
der.[20]
R is highly extensible through the use of user-submitted
packages for specific functions or specific areas of study.
Due to its S heritage, R has stronger object-oriented pro-
gramming facilities than most statistical computing lan-
guages. Extending R is also eased by its lexical scoping 3 Examples
rules.[15]
1
2 3 EXAMPLES
• use of community-developed external libraries installation of R, with more than 7,000 additional pack-
(called packages), in this case caTools package ages (as of August 2015) available at the Comprehensive
R Archive Network (CRAN), Bioconductor, Omegahat,
• handling of complex numbers GitHub and other repositories.[24]
• multidimensional arrays of numbers used as basic The “Task Views” page (subject list) on the CRAN
data type, see variables C, Z and X. website[25] lists a wide range of tasks (in fields such as
Finance, Genetics, High Performance Computing, Ma-
install.packages(“caTools”) # install external package chine Learning, Medical Imaging, Social Sciences and
library(caTools) # external package providing write.gif Spatial Statistics) to which R has been applied and for
function jet.colors <- colorRampPalette(c(“green”, which packages are available. R has also been identified
“blue”, “red”, “cyan”, "#7FFF7F”, “yellow”, "#FF7F00”, by the FDA as suitable for interpreting data from clinical
“red”, "#7F0000”)) m <- 1000 # define size C <- com- research.[26]
plex( real=rep(seq(−1.8,0.6, length.out=m), each=m Other R package resources include Crantastic, a commu-
), imag=rep(seq(−1.2,1.2, length.out=m), m ) ) C <- nity site for rating and reviewing all CRAN packages, and
matrix(C,m,m) # reshape as square matrix of complex R-Forge, a central platform for the collaborative devel-
numbers Z <- 0 # initialize Z to zero X <- array(0, opment of R packages, R-related software, and projects.
c(m,m,20)) # initialize output 3D array for (k in 1:20) R-Forge also hosts many unpublished beta packages, and
{ # loop with 20 iterations Z <- Z^2+C # the central development versions of CRAN packages.
difference equation X[,,k] <- exp(-abs(Z)) # capture
results } write.gif(X, “Mandelbrot.gif”, col=jet.colors, The Bioconductor project provides R packages for the
delay=900) analysis of genomic data, such as Affymetrix and cDNA
microarray object-oriented data-handling and analysis
tools, and has started to provide tools for analysis of data
from next-generation high-throughput sequencing meth-
ods.
5 Milestones
The full list of changes is maintained in the “R News” file
at CRAN.[27] Some highlights are listed below for several
major releases.
6 Interfaces
• RKWard – extensible GUI and IDE for R. 8 Comparison with SAS, SPSS and
• RStudio – cross-platform open source IDE (which
Stata
can also be run on a remote Linux server).
The general consensus is that R compares well with other
There is a special issue of the Journal of Statistical Soft- popular[51]
statistical packages, such as SAS, SPSS and
ware that discusses GUIs for R. [34] Stata. In January 2009, the New York Times ran an ar-
ticle about R gaining acceptance among data analysts and
presenting a potential threat for the market share occu-
6.2 Editors and IDEs pied by commercial statistical packages, such as SAS.[52]
• Comparison of statistical packages • Karl Rexer, Heather Allen, & Paul Gearan (2011);
2011 Data Miner Survey Summary, presented at
• List of numerical analysis software Predictive Analytics World, Oct. 2011.
• Hornik, Kurt (November 26, 2015). “R FAQ”. The [10] GNU project
Comprehensive R Archive Network. 2.1 What is R?.
Retrieved 2015-12-06. • “GNU R”. Free Software Foundation (FSF) Free
Software Directory. 19 July 2010. Retrieved 13
R Foundation November 2012.
• R Project (n.d.). “What is R?". Retrieved 2009-04-
• Hornik, Kurt (November 26, 2015). “R FAQ”. The
28.
Comprehensive R Archive Network. 2.13 What is
the R Foundation?. Retrieved 2015-12-06.
[11] “Wrathematics” (27 August 2011). “How Much of R Is
The R Core Team asks authors who use R in their data Written in R”. librestats. Retrieved 2011-12-01.
analysis to cite the software using:
[12] Eddelbuettel, Dirk; Francois, Romain (2011). “Rcpp:
• R Core Team (2015). R: A language and envi- Seamless R and C++ Integration”. Journal of Statistical
ronment for statistical computing. R Foundation Software 40 (8).
for Statistical Computing, Vienna, Austria. URL
http://www.R-project.org/. [13] Temple Lang, Duncan (6 November 2010). “Calling R
from Java” (PDF). Nuiton. Retrieved 18 September 2013.
[4] widely used
[14] .NET Framework
• Fox, John and Andersen, Robert (January 2005).
“Using the R Statistical Computing Environment • “Making GUIs using C# and R with the help of
to Teach Social Statistics Courses” (PDF). Depart- R.NET”.
ment of Sociology, McMaster University. Re-
• “R.NET homepage”.
trieved 2006-08-03.
• Haynold, Oliver M. (April 2011). An Rserve Client
• Vance, Ashlee (2009-01-06). “Data Analysts Cap-
Implementation for CLI/.NET (PDF). R/Finance
tivated by R’s Power”. New York Times. Retrieved
2011. Chicago, IL, USA.
2009-04-28. R is also the name of a popular pro-
gramming language used by a growing number of
[15] Jackman, Simon (Spring 2003). “R For the Political
data analysts inside corporations and academia. It
Methodologist” (PDF). The Political Methodologist (Po-
is becoming their lingua franca...
litical Methodology Section, American Political Science
[5] Vance, Ashlee (2009-01-06). “Data Analysts Captivated Association) 11 (1): 20–22. Archived from the original
by R’s Power”. New York Times. Retrieved 2009-04-28. (PDF) on 2006-07-21. Retrieved 2006-08-03.
R is also the name of a popular programming language
used by a growing number of data analysts inside corpo- [16] “CRAN Task View: Graphic Displays & Dynamic Graph-
rations and academia. It is becoming their lingua franca... ics & Graphic Devices & Visualization”. The Compre-
hensive R Archive Network. Retrieved 2011-08-01.
[6] R’s popularity
[17] Dalgaard, Peter (2002). Introductory Statistics with R.
• David Smith (2012); R Tops Data Mining Software New York, Berlin, Heidelberg: Springer-Verlag. pp. 10–
Poll, Java Developers Journal, May 31, 2012. 18, 34. ISBN 0387954759.
6 11 REFERENCES
[18] Ihaka, Ross; Gentlman, Robert (Sep 1996). “R: A Lan- [34] Valero-Mora, Pedro. “Graphical User Interfaces for R”.
guage for Data Analysis and Graphics” (PDF). Journal of Journal of Statistical Software (by Pedro M. Valero-Mora,
Computational and Graphical Statistics (American Statis- and Ruben Ledesma). Retrieved 2014.
tical Association) 5 (3): 299–314. doi:10.2307/1390807.
Retrieved 12 May 2014. [35] Stephan Wahlbrink. “StatET: Eclipse based IDE for R”.
Retrieved 2009-09-26.
[19] “Speed comparison of various number crunching pack-
ages (version 2)". SciView. 2003. Retrieved 2007-11-03. [36] Jose Claudio Faria. “R syntax”. Retrieved 2007-11-03.
[20] An Introduction to R, Section 5.1: Arrays (retrieved March [37] “Syntax Highlighting”. Kate Development Team.
2010). Archived from the original on 2008-07-07. Retrieved
2008-07-09.
[21] most used assignment operator in R is <-
[38] “R PEnterprise DevelopR”. Revolution Analytics. Re-
• R Development Core Team. “Writing R Exten- trieved 2014-04-17.
sions”. Retrieved 14 June 2012. [...] we recom-
mend the consistent use of the preferred assignment [39] J. J. Alaire and colleagues. “RStudio: new IDE for R”.
operator ‘<-’ (rather than ‘=’) for assignment. Retrieved 2011-08-04.
• “Google’s R Style Guide”. Retrieved 14 June 2012. [40] “NppToR: R in Notepad++". sourceforge.net. 8 May
• Wickham, Hadley. “Style Guide”. Retrieved 14 2013. Retrieved 18 September 2013.
June 2012.
[41] “Architect: integrated development environment for data
• Bengtsson, Henrik (January 2009). “R Coding science”. Open Analytics. Retrieved 2015-07-30.
Conventions (RCC) – a draft”. Retrieved 14 June
2012. [42] Gautier, Laurent (21 October 2012). “A simple and effi-
cient access to R from Python”. Retrieved 18 September
[22] R Development Core Team. “Assignments with the = Op- 2013.
erator”. Retrieved 14 June 2012.
[43] Statistics::R page on CPAN
[23] Kabacoff, Robert (2012). “Quick-R: User-Defined Func-
tions”. http://www.statmethods.net. Retrieved 28 October [44] RSRuby GitHub project
2013. External link in |website= (help)
[45] F# R Type Provider
[24] packages available from repositories
[46] Julia
• Robert A. Muenchen (2012). “The Popularity of
Data Analysis Software”. • https://github.com/lgautier/Rif.jl
• Tippmann, Sylvia (29 December 2014). • https://github.com/randy3k/RCall.jl
“Programming tools: Adventures with R”.
• http://rtalks.net/RCall.jl/
Nature (517): 109–110. doi:10.1038/517109a.
• “Search all R packages and function manuals | [47] Eddelbuettel, Dirk (14 July 2011). “littler: a scripting
Rdocumentation”. Rdocumentation. 2014-06-16. front-end for GNU R”. Retrieved 18 September 2013.
Retrieved 2014-06-16.
[48] “useR! 2004 - The R User Conference”. 27 May 2004.
[25] “CRAN Task Views”. cran.r-project.org. Retrieved 2014- Retrieved 18 September 2013.
07-03.
[49] R Project (9 August 2013). “R-related Conferences”. Re-
[26] http://blog.revolutionanalytics.com/2012/06/fda-r-ok. trieved 18 September 2013.
html
[50] “The useR! Conference 2015”. Retrieved 17 November
[27] “R News”. cran.r-project.org. Retrieved 2014-07-03. 2014.
[33] “Deducer Manual”. www.deducer.org. Retrieved 2014- [53] Timothy Prickett Morgan (2011); 'Red Hat for stats’ goes
07-03. toe-to-toe with SAS, The Register, February 7, 2011.
7
• Jaikumar Vijayan (2012); Oracle’s Big Data Appli- • R-bloggers, a daily news site about R, with 10,000+
ance brings focus to bundled approach, Computer- articles, tutorials and case-studies, contributed by
World, January 11, 2012. over 450 R bloggers.
• Timothy Prickett Morgan (2011); Oracle rolls its
own NoSQL and Hadoop Oracle rolls its own • The R Graphical Manual, a collection of R graphics
NoSQL and Hadoop, The Register, October 3, from all R packages, and an index to all functions in
2011. all R packages
[56] Chris Kanaracus (2012); Oracle Stakes Claim in R With • R seek, a custom frontend to Google search engine,
Advanced Analytics Launch, PC World, February 8, 2012. to assist in finding results related to the R language
13.2 Images
• File:8bit-dynamiclist.gif Source: https://upload.wikimedia.org/wikipedia/commons/1/1d/8bit-dynamiclist.gif License: CC-BY-SA-3.0
Contributors: Own work Original artist: Seahen
• File:Commons-logo.svg Source: https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg License: ? Contributors: ? Original
artist: ?
• File:Free_Software_Portal_Logo.svg Source: https://upload.wikimedia.org/wikipedia/commons/6/67/Nuvola_apps_emacs_vector.svg
License: LGPL Contributors:
• Nuvola_apps_emacs.png Original artist: Nuvola_apps_emacs.png: David Vignoni
• File:Heckert_GNU_white.svg Source: https://upload.wikimedia.org/wikipedia/en/2/22/Heckert_GNU_white.svg License: ? Contribu-
tors: ? Original artist: ?
• File:Mandelbrot_Creation_Animation.gif Source: https://upload.wikimedia.org/wikipedia/commons/a/a7/Mandelbrot_Creation_
Animation.gif License: GFDL Contributors: Own work Original artist: Jarekt
• File:Plots_from_lm_example.svg Source: https://upload.wikimedia.org/wikipedia/commons/f/f6/Plots_from_lm_example.svg License:
CC BY-SA 3.0 Contributors: travail personnel (own work), SVG conversion from File:Plots from lm example.png Original artist: Calimo
• File:R_logo.svg Source: https://upload.wikimedia.org/wikipedia/commons/1/1b/R_logo.svg License: GPL Contributors: Originally from
http://developer.r-project.org/Logo/Rlogo.svg, modified to simpler SVG format. Original artist: Original by Tobias Wolf in October 2010
• File:Wikibooks-logo-en-noslogan.svg Source: https://upload.wikimedia.org/wikipedia/commons/d/df/Wikibooks-logo-en-noslogan.
svg License: CC BY-SA 3.0 Contributors: Own work Original artist: User:Bastique, User:Ramac et al.
• File:Wikibooks-logo.svg Source: https://upload.wikimedia.org/wikipedia/commons/f/fa/Wikibooks-logo.svg License: CC BY-SA 3.0
Contributors: Own work Original artist: User:Bastique, User:Ramac et al.
• File:Wikiversity-logo-Snorky.svg Source: https://upload.wikimedia.org/wikipedia/commons/1/1b/Wikiversity-logo-en.svg License:
CC BY-SA 3.0 Contributors: Own work Original artist: Snorky