Content deleted Content added
ScalarFactor (talk | contribs) Reverting edit(s) by 2603:9009:801:B8E:995C:7A84:871B:8867 (talk) to rev. 1295643263 by Pac Veten: Non-constructive edit (UV 0.1.6) |
GoingBatty (talk | contribs) General fixes, replaced: Peanuts → ''Peanuts'' |
||
Line 51:
|doi-access=free }}</ref>
The core R language is extended by a large number of [[R package|software packages]], which contain [[Reusability|reusable code]], documentation, and sample data. Some of the most popular R packages are in the [[tidyverse]] collection, which enhances functionality for visualizing, transforming, and modelling data, as well as improves the ease of programming (according to the authors and users).<ref>{{Cite web |title=Home - RDocumentation |url=https://www.rdocumentation.org/ |access-date=2025-06-13 |website=www.rdocumentation.org}}</ref>
R is [[free and open-source software]] distributed under the [[GNU General Public License]].<ref name="gnugpl">{{Cite web |title=R - Free Software Directory |url=https://directory.fsf.org/wiki/R#tab=Details |access-date=2024-01-26 |website=directory.fsf.org}}</ref><ref>{{Cite web |title=R: What is R? |url=https://www.r-project.org/about.html |access-date=2025-05-10 |website=www.r-project.org}}</ref> The language is implemented primarily in [[C (programming language)|C]], [[Fortran]], and [[Self-hosting (compilers)|R itself]]. [[Preprocessor|Precompiled]] [[executable]]s are available for the major [[operating system]]s (including [[Linux]], [[MacOS]], and [[Microsoft Windows]]).
Line 175:
</syntaxhighlight>
The [[R package#Comprehensive R Archive Network (CRAN)|Comprehensive R Archive Network]] (CRAN) was founded in 1997 by Kurt Hornik and [[Friedrich Leisch]] to host R's [[source code]], executable files, documentation, and user-created packages.<ref name=":10" /> CRAN's name and scope mimic the [[Comprehensive TeX Archive Network]] (CTAN) and the [[Comprehensive Perl Archive Network]] (CPAN).<ref name=":10">{{Cite journal |last=Hornik |first=Kurt |date=2012 |title=The Comprehensive R Archive Network |url=https://onlinelibrary.wiley.com/doi/10.1002/wics.1212 |journal=WIREs Computational Statistics |language=en |volume=4 |issue=4 |pages=394–398 |doi=10.1002/wics.1212 |issn=1939-5108 |s2cid=62231320|url-access=subscription }}</ref> CRAN originally had only three [[
To provide guidance on the CRAN web site, its [https://cran.r-project.org/web/views/ Task Views] area lists packages that are relevant for specific topics; sample topics include [[causal inference]], [[finance]], [[genetics]], [[high-performance computing]], [[machine learning]], [[medical imaging]], [[meta-analysis]], [[social science]]s, and [[spatial statistics]].
Line 266:
</syntaxhighlight>
=== Structure of a function ===
R is able to create [[Function (computer programming)|functions]] that add new functionality for code reuse.<ref>{{cite web|url=http://www.statmethods.net/management/userfunctions.html|title=Quick-R: User-Defined Functions|first=Robert|last=Kabacoff|year=2012|access-date=2018-09-28|website=statmethods.net}}</ref> [[Object (computer science)|Objects]] created within the body of the function (which are enclosed by curly brackets) remain [[Local variable|accessible only]] from within the function, and any [[data type]] may be returned. In R, almost all functions and all [[user-defined function]]s are [[closure (computer programming)|closures]].<ref>{{cite web|url=http://adv-r.had.co.nz/Functional-programming.html#closures|title=Advanced R - Functional programming - Closures|website=adv-r.had.co.nz|first=Hadley|last=Wickham}}</ref>
Line 325 ⟶ 326:
> print(num_mtcars_subset)
[1] 11
</syntaxhighlight>While the pipe operator can produce code that is easier to read, it is advisable to chain together at most 10-15 lines of code using this operator, as well as to chunk code into [[Task (project management)|sub-tasks]] that are saved into objects having meaningful names.<ref>{{Cite book |last=Wickham |first=Hadley |url=https://r4ds.hadley.nz/ |title=R for data science: import, tidy, transform, visualize, and model data |last2=Çetinkaya-Rundel |first2=Mine |last3=Grolemund |first3=Garrett |date=2023 |publisher=O'Reilly |isbn=978-1-4920-9740-2 |edition=2nd |___location=Beijing; Sebastopol, CA |chapter=4 Workflow: code style |oclc=on1390607935 |chapter-url=https://r4ds.hadley.nz/workflow-style.html}}</ref>
The following is an example having fewer than 10 lines, which some readers may find difficult to grasp in the absence of intermediate named steps:<syntaxhighlight lang="r" line="1">(\(x, n = 42, key = c(letters, LETTERS, " ", ":", ")"))
Line 455 ⟶ 456:
== Version names ==
[[File:CD of R 1 0 0.png|alt=A CD with autographs on it|thumb|A CD of R Version 1.0.0, autographed by the core team of R, photographed in Quebec City in 2019|180x180px]]
All R version releases from 2.14.0 onward have [[Code name|codenames]] that make reference to ''[[Peanuts]]'' comics and films.<ref>{{Cite book |last=Monkman |first=Martin |url=https://bookdown.org/martin_monkman/DataScienceResources_book/r-release-names.html |title=Chapter 5 R Release Names {{!}} Data Science with R: A Resource Compendium}}</ref><ref>{{Cite web |last=McGowan |first=Lucy D’Agostino |date=2017-09-28 |title=R release names |url=https://livefreeordichotomize.com/posts/2017-09-28-r-release-names/index.html |access-date=2024-04-07 |website=livefreeordichotomize.com |language=en}}</ref><ref>{{Citation |title=r-hub/rversions |date=2024-02-29 |url=https://github.com/r-hub/rversions |access-date=2024-04-07 |publisher=The R-hub project of the R Consortium}}</ref>
In 2018, core R developer [[Peter Dalgaard]] presented a history of R releases since 1997.<ref name=":2">{{Cite web |last=Dalgaard |first=Peter |date=2018-07-15 |title=What's in a name? 20 years of R release management |url=https://www.youtube.com/watch?v=z1vTSdRolgI |access-date=2024-04-09 |website=[[YouTube]] |format=video}}</ref> Some notable early releases before the named releases include the following:
Line 879 ⟶ 880:
** [[Eclipse (software)|Eclipse]] via the [https://marketplace.eclipse.org/content/statet-r/ StatET plugin]
** [[Microsoft Visual Studio|Visual Studio]] via [[R Tools for Visual Studio]].
* [[Source-code editor
** [[Emacs Speaks Statistics|Emacs]]
** [[Vim (text editor)|Vim]] via the [https://www.vim.org/scripts/script.php?script_id=2628 Nvim-R plugin]
Line 896 ⟶ 897:
** [[C Sharp (programming language)|.NET C#]] ([https://rdotnet.github.io/rdotnet/ website])
Statistical frameworks that use R in the background include [[Jamovi]] and [[JASP]].{{
== Implementations ==
|