[go: up one dir, main page]

Jump to content

R (programming language)

From Simple English Wikipedia, the free encyclopedia
R
R terminal
ParadigmsMulti-paradigm: Array programming, object-oriented, imperative, functional
Designed byRoss Ihaka and Robert Gentleman (statistician)
DeveloperR Core Team[1]
First appearedAugust 1993; 31 years ago (1993-08)[2]
Stable release4.4.2[3] Edit this on Wikidata (codename "Pile of Leaves") / 31 October 2024; 12 days ago (31 October 2024)
LicenseGNU GPL v2[4]
Filename extensions
  • .r
  • .rdata
  • .rds
  • .rda
Websitewww.r-project.org Edit this at Wikidata
Influenced by
Influenced
Julia[5]

R is a programming language and free software environment for statistics.[6][7][8][9][10][11] R is a language built for a specific purpose. It is strictly designed for statistical analysis. The algorithms for many statistical models are devised in R. Precisely R is the language of Statistical Analyzers. It’s an open source and the best suite for the statisticians to develop statistical softwares.

Usage in other areas

[change | change source]

The R language was originally made for statistics. But today, it is also used in many scientific fields including ecology.[12][13]

Development history

[change | change source]

A list of changes in R releases is maintained in various "news" files at CRAN (Comprehensive R Archive Network).[14] Some highlights are listed below for several major releases.

Release Date Description
0.16 This is the last test version.
0.49 1997-04-23 This is the oldest source release which is currently available on CRAN.[15] CRAN is started on this date, with 3 mirrors that initially hosted 12 packages.[16]
0.60 1997-12-05 R becomes an official part of the GNU Project. The code is hosted and maintained on CVS.
0.65.1 1999-10-07 First versions of update.packages and install.packages functions for downloading and installing packages from CRAN.[17]
1.0 2000-02-29 The developers declared that it is stable enough for production use.[18]
1.4 2001-12-19 S4 methods are introduced and the first version for Mac OS X is made available soon after.
1.8 2003-10-08 Introduced a flexible condition handling mechanism for signalling and handling condition objects.
2.0 2004-10-04 Introduced fast loading of data with minimal expense of system memory.
2.1 2005-04-18 Support for UTF-8 encoding. They also started of internationalization and localization for different languages.
2.6.2 2008-02-08 Last version to support Windows 95, 98, Me and NT 4.0[19]
2.11 2010-04-22 Support for Windows 64 bit systems.
2.12.2 2011-02-25 Last version to support Windows 2000[20]
2.13 2011-04-14 Adding a new compiler function that allows speeding up functions by converting them to byte-code.
2.14 2011-10-31 Added mandatory namespaces for packages. Added a new parallel package.
2.15 2012-03-30 New load balancing functions. Improved serialization speed for long vectors.
3.0.0 2013-04-03 Support for numeric index values 231 and larger on 64 bit systems.
3.3.3 2017-03-06 Last version to support Microsoft Windows XP.
3.4.0 2017-04-21 Just-in-time compilation (JIT) of functions and loops to byte-code enabled by default.
3.5.0 2018-04-23 Packages byte-compiled on installation by default. Compact internal representation of integer sequences. Added a new serialization format to support compact internal representations.
3.6.0 2019-04-26
4.0.0 2020-04-24

Communities

[change | change source]

R has local communities worldwide for users to share ideas and learn.[21][22]

There are a growing number of R events bringing its users together, such as conferences (e.g. useR!, WhyR?, conectaR, SatRdays)[23][24] and other meetups.[25]

useR! conferences

[change | change source]

The official annual gathering of R users is called "useR!".[26] The first such event was useR! 2004 in May 2004, Vienna, Austria.[27] After skipping 2005, the useR! conference has been held annually.[28] Subsequent conferences have included:[26]

Future conferences planned are as follows:[26][29]

The R Journal

[change | change source]

The R Journal is the open access refereed journal of the R project. It features articles on the use and development of the R language.

Basic syntax

[change | change source]

The following examples illustrate the basic syntax of the language and use of the command-line interface.

In R, the generally preferred[30] assignment operator is an arrow made from two characters <-. Although = can be used instead.[31]

> x <- 1:6  # Create vector.
> y <- x^2  # Create vector by formula.
> print(y)  # Print the vector’s contents.
[1]  1  4  9 16 25 36

> mean(y)  # Arithmetic mean of vector.
[1] 15.16667

> var(y)  # Sample variance of vector.
[1] 178.9667

> model <- lm(y ~ x)  # Linear regression model y = A + B * x.
> print(model)  # Print the model’s results.

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x 
     -9.333        7.000

> summary(model)  # Display an in-depth summary of the 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))  # Create a 2 by 2 layout for figures.
> plot(model)  # Output diagnostic plots of the model.

Diagnostic plots from plotting “model” (q.v. “plot.lm()” function). Notice the mathematical notation allowed in labels (lower left plot).


References

[change | change source]
  1. Hornik, Kurt (November 26, 2015). "R FAQ". The Comprehensive R Archive Network. 2.1 What is R?. Retrieved 2018-08-05.
  2. 2.0 2.1 Ihaka, Ross (1998). R : Past and Future History (PDF). Interface '98 (Technical report). Statistics Department, The University of Auckland, Auckland, New Zealand.
  3. Peter Dalgaard (31 October 2024). "4.4.2 is released". Retrieved 1 November 2024.
  4. "R license". r-project. Retrieved 2018-08-05.
  5. "Introduction". The Julia Manual. Archived from the original on 20 June 2018. Retrieved 5 August 2018.
  6. Crawley, M. J. (2012). The R book. John Wiley & Sons.
  7. Dalgaard, P. (2008). Introductory statistics with R. Springer.
  8. Maronna, R. A., Martin, R. D., & Yohai, V. J. (2019). Robust statistics: theory and methods (with R). John Wiley & Sons.
  9. Ugarte, M. D., Militino, A. F., & Arnholt, A. T. (2008). Probability and Statistics with R. CRC Press.
  10. Bruce, P., Bruce, A., & Gedeck, P. (2020). Practical Statistics for Data Scientists: 50+ Essential Concepts Using R and Python. O'Reilly Media.
  11. Kruschke, J. (2014). Doing Bayesian data analysis: A tutorial with R, JAGS, and Stan. Academic Press.
  12. Borcard, D., Gillet, F., & Legendre, P. (2018). Numerical ecology with R. Springer.
  13. Bolker, B. M. (2008). Ecological models and data in R. Princeton University Press.
  14. Changes in versions 3.0.0 onward: "R News". cran.r-project.org. Retrieved 2014-07-03. Earlier change logs (by major release number):
    • "NEWS". cran.r-project.org. Retrieved 2020-06-28.
    • "NEWS.3". cran.r-project.org. Retrieved 2020-06-28.
    • "NEWS.2". cran.r-project.org. Retrieved 2017-04-08.
    • "NEWS.1". cran.r-project.org. Retrieved 2017-04-08.
    • "NEWS.0". cran.r-project.org. Retrieved 2017-04-08.
  15. "Index of /src/base/R-0".
  16. "ANNOUNCE: CRAN".
  17. https://cran.r-project.org/src/base/NEWS.0
  18. Peter Dalgaard. "R-1.0.0 is released". Retrieved 2009-06-06.
  19. https://cran-archive.r-project.org/bin/windows/base/old/2.7.0/CHANGES.R-2.7.0
  20. "R FAQ". Retrieved 2020-03-20.
  21. "Local R User Group Directory". Revolutions Blog. Retrieved 12 May 2018.
  22. A list of R conferences and meetings. Retrieved 12 May 2018. {{cite book}}: |website= ignored (help)
  23. "official website of WhyR? conference". WhyR?. Retrieved 26 June 2019.
  24. "SatRdays listing". SatRdays. Retrieved 26 June 2019.
  25. "R Project for Statistical Computing". Meetup. Retrieved 12 May 2018.
  26. 26.0 26.1 26.2 "R: Conferences". r-project.org. 2019-11-01. Retrieved 2019-11-19.
  27. "useR! 2004 - The R User Conference". 27 May 2004. Archived from the original on 2013-09-14. Retrieved 2018-09-09.
  28. R Project (9 August 2013). "R-related Conferences". Retrieved 2019-08-15.
  29. "UseR! 2021 - The R User Conference". Retrieved 2020-03-23.
  30. most used assignment operator in R is <-
  31. R Development Core Team. "Assignments with the = Operator". Retrieved 2018-09-11.

Other websites

[change | change source]