R
Модел2.9.2
Појавио се1993 [1]
Аутор(и)R Development Core Team
Дизајнер(и)Ross Ihaka and Robert Gentleman
Актуелна верзијаThrough SVN
Датум актуелне верзије24. август 2009. год.; пре 14 година (2009-08-24)
УтицајиS
Оперативни системиCross-platform
ЛиценцаGNU General Public License
Веб-сајтhttp://www.r-project.org/

У рачунарству, R је програмски језик и програмско окружење за статистичке израчуне и графике. Он је изведба S програмског језика са лексичком семантиком инспирисаном Scheme (програмски језик)ом. R су створили Рос Ихака и Роберт Џентлмен[2] на Аукланд универзитету (University of Auckland), Нови Зеланд, а сад га развија R Development Core Team. Назван је дјелимично према именима аутора, а дјелом као игра ријечи на име S.[3]

R језик је постао стандард међу статистичарима који развијају статистички софтвер,[4][5] и широко је коришћен за развој статистичког софтвера и анализу података.[5]

R је дио ГНУ пројекта.[6] Његов изворни код је слободан и под условима које даје ГНУ-ова општа јавна лиценца, а прекомпилиране бинарне верзије су обезбјеђене за различите оперативне системе. R користи интерфејс командне линије, кроз више графичких корисничких окружења.

Особине уреди

R обезбјеђује широк избор статистичких (линеарних и нелинеарних модела, класичних статистичких тестова, анализа временских серија, класификација, кластери, и остало) и графичких техника. R, је слично као S, пројектован као прави програмски језик, и омогућава корисницима додатну функционалност дефинисањем нових функција. Постоји више важних разлика, али доста кода може бити искориштен као S, непромјењен. Много R-овог система је такође писана у овом језику, што га чини лакшим за кориснике при формирању алгоритама. Код захтјевних задатака, C, C++ и Фортран код може бити повезан и покренут. Напредни корисници могу писати C код за манипулисање R-ових објеката директно.

R може бити проширен, кроз пкете обезбјеђене од корисника, за специфичне функције или специфичне области проучавања. Због свог S наслеђа, R има бољу подршку за Објектно-орјентисано програмирање него остали статистички програмски језици. Проширивост R-а је олакшана и његовим попустљивим језичким опсегом.[7]

Сљедећа предност R-а су његове графичке могућности, које обезбјеђују графике квалитета довољно доброг за публиковање који укључују математичке симболе. R има сопствени LaTeX-олики формат докумената, који се користи за представљање свеобухватне документације, преко интернета у бројним форматима или као штампана копија.

Иако је R претежно кориштен од статистичара и практичара који захтјевају окружење за статистичке прорачуне и развој софтвера, такође може бити кориштен као општи алат за израчунавање матрица учинка упоредивог са оним од ГНУ Октав и његовог власничког конкурента, MATLAB.[8] RWeka[9] сучеље је додато популарном софтверу за излучивање података Weka које дозвољава могућност уписа и читања у arff формату који даље омогућава кориштење могућности програма.

Примјери уреди

Сљедећи примјери илуструју основе синтаксе језика и кориштење командне линије.

 
Diagnostic graphs produced by plot.lm() function. Features include mathematical notation in axis labels, as at lower left.
> x <- c(1,2,3,4,5,6)   # Create ordered collection
> y <- x^2              # Square the elements of x
> mean(y)               # Calculate arithmetic mean of y
[1] 15.16667
> var(y)                # Calculate sample variance
[1] 178.9667
> summary(lm(y ~ x))    # Fit a linear regression model

Call:
lm(formula = y ~ x)

Residuals:
1       2       3       4       5       6
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))    # Request 2x2 plot layout
> plot(lm(y ~ x))       # Diagnostic plot of regression model

Пакети уреди

The capabilities of R are extended through user-submitted packages, which allow specialized statistical techniques, graphical devices, as well as programming interfaces and import/export capabilities to many external data formats. These packages are developed in R, LaTeX, Java, and often C and Fortran. A core set of packages are included with the installation of R, with a total of 1862 (as of June 2009) available at the Comprehensive R Archive Network (CRAN). Notable packages by subject area are listed along with comments on the official R Task View pages.

Развој уреди

The bioconductor project, which started in the fall of 2001, provides R packages for the analysis of genomic data, such as Affymetrix and cDNA microarray object-oriented data handling and analysis tools.

The Gnumeric developers have cooperated with the R project to improve the accuracy of Gnumeric.[10]

Milestones уреди

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 1.0.0 – February 29, 2000 – Considered by its developers stable enough for production use [11].
  • 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 – Introduced lazy loading, which enables fast loading of data with minimal expense of system memory.
  • Version 2.9.0 – Package 'Matrix' is now a recommended package contained in the basic R distribution.

Productivity tools уреди

There are various interfaces to R.

Графичко сучеље уреди

  • Java Gui for R - cross-platform stand-alone R terminal and editor based on Java (also known as JGR)
  • 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
  • rggobi, an interface to GGobi for visualization of matrices
  • RKWard - based on the KDE libraries
  • Sage - web browser interface as well as rpy support
  • Statistical Lab
  • nexusBPM - Automation Tool for R, eclipse plug-in to create R process flows and run R in parallel

Editors and IDEs уреди

Text editors and Integrated development environments (IDEs) with some support for R include Bluefish,[12] Crimson Editor, ConTEXT, Eclipse, Emacs (Emacs Speaks Statistics), Geany, jEdit,[13] Kate,[14] Syn, TextMate, Tinn-R, Vim, gedit, SciTE, Smultron, WinEdt (R Package RWinEdt), and Inference for R.

Sweave is a document processor that can execute R code embedded within LaTeX code and convert both the source and results (including graphical output) into LaTeX source code. One may also use LyX to create and compile Sweave documents. The odfWeave package enables similar processing of R code embedded within word processing documents in OpenDocument format (ODF), and has experimental support for spreadsheets and presentations.

Скриптни језици уреди

R functionality has been made accessible from several scripting languages such as Python (by the RPy[15] interface package) and Perl (by the Statistics::R[16] module). Scripting in R itself is possible via littler[17] as well as via Rscript which has been part of the R core distribution since release 2.5.0.

Види још уреди

Референце уреди

  1. ^ A Brief History R : Past and Future History, Ross Ihaka, Statistics Department, The University of Auckland, Auckland, New Zealand, available from the CRAN website
  2. ^ „Robert Gentleman's home page”. Приступљено 20. 07. 2009. 
  3. ^ Hornik, Kurt. The R FAQ: Why is R named R?. ISBN 978-3-900051-08-2. Приступљено 29. 01. 2008. 
  4. ^ Fox, John and Andersen, Robert (јануар 2005). „Using the R Statistical Computing Environment to Teach Social Statistics Courses” (PDF). Department of Sociology, McMaster University. Приступљено 2006-08-03. 
  5. ^ а б Vance, Ashlee (06. 01. 2009). „Data Analysts Captivated by R's Power”. New York Times. Приступљено 28. 04. 2009. „R is also the name of a popular programming language used by a growing number of data analysts inside corporations and academia. It is becoming their lingua franca... 
  6. ^ „What is R?”. Приступљено 28. 04. 2009. 
  7. ^ Jackman, Simon (пролеће 2003). „R For the Political Methodologist” (PDF). The Political Methodologist. Political Methodology Section, American Political Science Association. 11 (1): 20—22. Приступљено 2006-08-03. 
  8. ^ „Speed comparison of various number crunching packages (version 2)”. SciView. Приступљено 03. 11. 2007. 
  9. ^ „RWeka: An R Interface to Weka. R package version 0.3-17”. Kurt Hornik, Achim Zeileis, Torsten Hothorn and Christian Buchta. Приступљено 2009.  Проверите вредност парамет(а)ра за датум: |access-date= (помоћ)
  10. ^ Gnumeric, Team (2004-12-19). „Gnumeric 1.4 is Here!”. The GNOME Project. Приступљено 2006-04-30.  Проверите вредност парамет(а)ра за датум: |date= (помоћ)
  11. ^ Dalgaard, Peter. „R-1.0.0 is released”. Приступљено 06. 06. 2009. 
  12. ^ 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.
  13. ^ Jose Claudio Faria. „R syntax”. Приступљено 03. 11. 2007. 
  14. ^ „Syntax Highlighting”. Kate Development Team. Приступљено 09. 07. 2008. 
  15. ^ RPy home page
  16. ^ Statistics::R page on CPAN
  17. ^ littler web site

Спољашње везе уреди