alih kekasih yang tak dianggap
r adalah implementasi dari bahasa pemrograman s yang dikombinasikan dengan pelingkupan leksikal semantik yang terinspirasi oleh scheme.
s diciptakan oleh john chambers ketika masih di bell labs. r diciptakan oleh ross ihaka dan robert gentleman at the university of auckland, new zealand, dan sekarang dikembangkan oleh tim inti pengembangan r, dengan chambers sebagai anggota.
nama r sebagian berasal dari nama depan dari dua pengembang r pertama (robert gentleman and ross ihaka), dan sebagian sebagai permainan dari nama s.
r merupakan bagian dari gnu project.
kode sumbernya tersedia secara bebas dibawah lisensi gnu general public license, dan versi pre-compiled binary tersedia untuk berbagai sistem operasi.
r menggunakan command line interface; namun, beberapa graphical user interface juga tersedia untuk digunakan bersama r.
r provides a wide variety of statistical and graphical techniques, including linear and nonlinear modeling, classical statistical tests, time-series analysis, classification, clustering, and others.
r is easily extensible through functions and extensions, and the r community is noted for its active contributions in terms of packages.
there are some important differences, but much code written for s runs unaltered.
many of r's standard functions are written in r itself, which makes it easy for users to follow the algorithmic choices made.
for computationally intensive tasks, c, c++, and fortran code can be linked and called at run time.
advanced users can write c or java code to manipulate r objects directly.
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 programming facilities than most statistical computing languages.
extending r is also eased by its permissive lexical scoping rules.
according to rexer's annual data miner survey in 2010, r has become the data mining tool used by more data miners (43%) than any other.
another strength of r is static graphics, which can produce publication-quality graphs, including mathematical symbols.
dynamic and interactive graphics are available through additional packages such as rgl.
r has its own latex-like documentation format, which is used to supply comprehensive documentation, both on-line in a number of formats and in hard copy.
r is an interpreted language typically used through a command line interpreter.
if one types "2+2" at the command prompt and presses enter, the computer replies with "4".
like many other languages, r supports matrix arithmetic.
r's data structures include scalars, vectors, matrices, data frames (similar to tables in a relational database) and lists.
the r object system has been extended by package authors to define objects for regression models, time-series and geo-spatial coordinates.
r supports procedural programming with functions and, for some functions, object-oriented programming with generic functions.
a generic function acts differently depending on the type of arguments it is passed.
in other words the generic function dispatches the function (method) specific to that type of object.
for example, r has a generic print() function that can print almost every type of object in r with a simple "print(objectname)" syntax.
although r is mostly used by statisticians and other practitioners requiring an environment for statistical computation and software development, it can also be used as a general matrix calculation toolbox with performance benchmarks comparable to gnu octave or matlab.
an r interface has been added to the popular data mining software weka, which allows for the use of the data mining capabilities in weka and statistical analysis in r.
similarly, an r interface r extension presented on rcomm 2010 to the widely used open source data mining software rapidminer, allows the integration of the statistical analysis available in r into rapidminer data mining processes.
some proprietary analysis software vendors like sas have introduced connectors to r.
the following examples illustrate the basic syntax of the language and use of the command-line interface.
in r and s, the assignment operator is an arrow made from two characters "<-".
> x <- c(1,2,3,4,5,6) # create ordered collection (vector)
> y <- x^2 # square the elements of x
> print(y) # print (vector) y
[1] 1 4 9 16 25 36
> mean(y) # calculate average (arithmetic mean) of (vector) y; result is scalar
> var(y) # calculate sample variance
> lm_1 <- lm(y ~ x) # fit a linear regression model "y = f(x)" or "y = b0 + (b1 * x)"
# store the results as lm_1
> print(lm_1) # print the model from the (linear model object) lm_1
lm(formula = y ~ x)
> summary(lm_1) # compute and print statistics for the fit of the (linear model object) lm_1
lm(formula = y ~ x)
1 2 3 4 5 6
3.3333 -0.6667 -2.6667 -2.6667 -0.6667 3.3333
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 ***
codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1   1
residual standard error: 3.055 on 4 degrees of freedom
f-statistic: 91.88 on 1 and 4 df, p-value: 0.000662
> par(mfrow=c(2, 2)) # request 2x2 plot layout
> plot(lm_1) # diagnostic plot of regression model
diagnostic graphs produced by plot.lm() function.
features include mathematical notation in axis labels, as at lower left.
short r code calculating mandelbrot set through the first 20 iterations of equation z = z2 + 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
multidimensional arrays of numbers used as basic data type, see variables c, z and x
library(catools) # external package providing write.gif function
jet.colors <- colorramppalette(c("#00007f", "blue", "#007fff", "cyan", "#7fff7f",
"yellow", "#ff7f00", "red", "#7f0000"))
m <- 1200 # define size
c <- complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
imag=rep(seq(-1.2,1.2, length.out=m), m ) )
c <- matrix(c,m,m) # reshape as square matrix of complex numbers
z <- 0 # initialize z to zero
x <- array(0, c(m,m,20)) # initialize output 3d array
for (k in 1:20) { # loop with 20 iterations
z <- z^2+c # the central difference equation
x[,,k] <- exp(-abs(z)) # capture results
write.gif(x, "mandelbrot.gif", col=jet.colors, delay=100)
the capabilities of r are extended through user-created packages, which allow specialized statistical techniques, graphical devices, import/export capabilities, reporting tools, etc.
these packages are developed primarily in r, and sometimes in java, c and fortran.
a core set of packages are included with the installation of r, with more than 4300 (
the "task views" page (subject list) on the cran website lists the wide range of applications (finance, genetics, machine learning, medical imaging, social sciences and spatial statistics) to which r has been applied and for which packages are available.
other r package resources include crantastic, a community site for rating and reviewing all cran packages.
and also r-forge, a central platform for the collaborative development of r packages, r-related software and projects.
it hosts many unpublished, beta packages and development versions of cran packages.
the bioconductor project provides r packages for the 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 methods.
reproducible research and automated report generation can be accomplished with packages that support
execution of r code embedded within latex, opendocument format and other markups.
the full list of changes is maintained in the news file.
some highlights are listed below.
version 0.16  this is the last alpha version developed primarily by ihaka and gentleman.
much of the basic functionality from the "white book" (see s history) was implemented.
the mailing lists commenced on april 1, 1997.
version 0.49  april 23, 1997  this is the oldest available source release, and compiles on a limited number of unix-like platforms.
cran is started on this date, with 3 mirrors that initially hosted 12 packages.
alpha versions of r for microsoft windows and mac os are made available shortly after this version.
version 0.60  december 5, 1997  r becomes an official part of the gnu project.
the code is hosted and maintained on cvs.
version 1.0.0  february 29, 2000  considered by its developers stable enough for production use.
version 1.4.0  s4 methods are introduced and the first version for mac os x is made available soon after.
version 2.0.0  october 4, 2004  introduced lazy loading, which enables fast loading of data with minimal expense of system memory.
version 2.1.0  support for utf-8 encoding, and the beginnings of internationalization and localization for different languages.
version 2.11.0  april 22, 2010  support for windows 64 bit systems.
version 2.13.0  april 14, 2011  adding a new compiler function that allows speeding up functions by converting them to byte-code.
graphical user interfaces
rgui  comes with the pre-compiled version of r
java gui for r  cross-platform stand-alone r terminal and editor based on java (also known as jgr)
deducer - gui for menu driven data analysis (similar to spss/jmp/minitab).
it has a to do common data manipulation and analysis tasks, and an excel- designed to be used with jgr but also rgui.
rattle gui  cross-platform gui based on rgtk2 and specifically designed for data mining
r commander  cross-platform menu-driven gui based on tcltk (several plug-ins to rcmdr are also available)
rexcel  using r and rcmdr from within microsoft excel
sage  web browser interface as well as rpy support
sim.diffprocgui  graphical user interface for simulation of diffusion processes based on tcltk
cantor (software)  kde worksheet interface to several mathematical applications, including r
red-r  visual analysis interface that uses r for statistics
tinn-r  gui for r language and environment
rkward  extensible gui and ide for r
r analyticflow - analysis flowcharts with r (freeware)
rstudio - cross-platform open source ide (which can also be run on a remote linux server)
rapidminer and the rapidminer r extension - extensible open source gui and ide for r, weka, and rapidminer data mining processes and their seamless integration
editors and ides
text editors and integrated development environments (ides) with some support for r include:
bluefish,customizable syntax highlighting based on perl compatible regular expressions, with subpattern support and default patterns for..r, tenth bullet point,
bluefish features, bluefish website, retrieved 9 july 2008.
emacs (emacs speaks statistics),
gedit, scite, winedt (r package rwinedt), rpe, notepad++ and sciviews.
r functionality has been made accessible from several scripting languages such as python (by the rpy rpy home page interface package), perl (by the statistics::r statistics::r page on [[cpan]] module) and ruby (with the rsruby rsruby rubyforge project rubygem).
scripting in r itself is possible via littler littler web site as well as via rscript.
relationship with sas
r is often compared to other statistical packages, with its main competitor being sas. one popular consensus is that r is at par with sas except in the realm of very large data sets.
comparison of r to sas, stat and spss
in january 2009, the new york times ran an article about r gaining acceptance among data analysts.
the paper quoted anne milley of sas saying that the company has "customers who build engines for aircraft.
i am happy they are not using freeware when i get on a jet," which resulted in criticism of milley from both r and sas users alike.
in a blog comment, milley later apologized for her remark.
in march of the same year, sas announced plans to offer r integration in its software.
commercial support for r
in 2007, revolution analytics was founded to provide commercial support for a version of r that it developed for clusters of workstations called parallelr. in 2011, the ability for reading and writing data in the sas file format was first added in revolution's enterprise r. 'red hat for stats' goes toe-to-toe with sas.
other commercial software systems supporting connections to r include oracle, spotfire, spss, statistica and platform symphony.
r integrated with symphony
list of statistical packages
comparison of statistical packages
list of numerical analysis software
comparison of numerical analysis software
free statistical software