ArticleslgStudy

computer science

R (programming language)

R (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand R (programming language) rather than just read about it. In short: R is a programming language for statistical computing and data visualization. It has been widely adopted in the fields of data mining, bioinformatics, data analysis, and data science.

R (programming language) — main illustration
R (programming language) — illustration

Key takeaways

  • R (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect R (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of R (programming language) from memory before moving on to harder problems.

Reference excerpt

R is a programming language for statistical computing and data visualization. It has been widely adopted in the fields of data mining, bioinformatics, data analysis, and data science. The core R language is extended by a large number of software packages, which contain 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). R is free and open-source software distributed under the GNU General Public License. The language is implemented primarily in C, Fortran, and R itself. Precompiled executables are available for the major operating systems (including Linux, MacOS, and Microsoft Windows). Its core is an interpreted language with a native command line interface. In addition, multiple third-party applications are available as graphical user interfaces; such applications include RStudio (an integrated development environment), Jupyter (a notebook interface), as well as Termux and Google Colab for mobile devices.

History

R was started by professors Ross Ihaka and Robert Gentleman as a programming language to teach introductory statistics at the University of Auckland. The language was inspired by the S programming language, with most S programs able to run unaltered in R. The language was also inspired by Scheme's lexical scoping, allowing for local variables. The name of the language, R, comes from being both an S language successor and the shared first letter of the authors, Ross and Robert. In August 1993, Ihaka and Gentleman posted a binary file of R on StatLib — a data archive website. At the same time, they announced the posting on the s-news mailing list. On 5 December 1997, R became a GNU project when version 0.60 was released. On 29 February 2000, the 1.0 version was released.

Packages

R packages are collections of functions, documentation, and data that expand R. For example, packages can add reporting features (using packages such as R Markdown, Quarto, knitr, and Sweave) and support for various statistical techniques (such as linear, generalized linear and nonlinear modeling, classical statistical tests, spatial analysis, time-series analysis, and clustering). Ease of package installation and use have contributed to the language's adoption in data science. Immediately available when starting R after installation, base packages provide the fundamental and necessary syntax and commands for programming, computing, graphics production, basic arithmetic, and statistical functionality. An example is the tidyverse collection of R packages, which bundles several subsidiary packages to provide a common API. The collection specializes in tasks related to accessing and processing "tidy data", which are data contained in a two-dimensional table with a single row for each observation and a single column for each variable. Installing a package occurs only once. For example, to install the tidyverse collection:

To load the functions, data, and documentation of a package, one calls the library() function. To load the tidyverse collection, one can execute the following code:

The 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. CRAN's name and scope mimic the Comprehensive TeX Archive Network (CTAN) and the Comprehensive Perl Archive Network (CPAN). CRAN originally had only three mirror sites and twelve contributed packages. As of 30 June 2025, it has 90 mirrors and 22,390 contributed packages. Packages are also available in repositories such as R-Forge, Omegahat, and GitHub. To provide guidance on the CRAN web site, its 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 sciences, and spatial statistics. The Bioconductor project provides packages for genomic data analysis, complementary DNA, microarray, and high-throughput sequencing methods.

Community

There are three main groups that help support R software development:

The R Core Team was founded in 1997 to maintain the R source code. In 2026, it was awarded the Rousseeuw Prize for Statistics for its contributions to statistical research and impact on society. The R Foundation for Statistical Computing was founded in April 2003 to provide financial support. The R Consortium is a Linux Foundation project to develop R infrastructure. The R Journal is an open access, academic journal that features short to medium-length articles on the use and development of R. The journal includes articles on packages, programming tips, CRAN news, and foundation news.

The R community hosts many conferences and in-person meetups. These groups include:

useR!: an annual international R user conference (website) Directions in Statistical Computing (DSC) (website) R-Ladies: an organization to promote gender diversity in the R community (website) SatRdays: R-focused conferences held on Saturdays (website) Data Science & AI Conferences (website) posit::conf (formerly known as rstudio::conf) (website) uRos: an annual conference on the Use of R in Official Statistics (website) On social media sites such as Twitter, the hashtag #rstats can be used to follow new developments in the R community.

Examples

Hello, World! The following is a "Hello, World!" program:

Here is an alternative version, which uses the cat() function:

Basic syntax The following examples illustrate the basic syntax of the language and use of the command-line interface. In R, the generally preferred assignment operator is an arrow made from two characters <-, although = can be used in some cases.

Structure of a function R can create functions that add new functionality and enable code reuse. Objects created within the body of the function (which are enclosed by curly brackets) remain accessible only from within the function, and any data type may be returned. In R, almost all functions and all user-defined functions are closures. The following is an example of creating a function to perform an arithmetic calculation:

The following is some output from using the function defined above:

… excerpt ends here. Continue reading the full article.

Illustrations

R (programming language) illustration
R (programming language) illustration
R (programming language) illustration
R (programming language) illustration
R (programming language): A violin plot created with the R package ggplot2 for data visualization
A violin plot created with the R package ggplot2 for data visualization

Worked examples

Example 1 — a first encounter with R (programming language)

Start with the simplest possible case. Write down what R (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to R (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about R (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of R (programming language)

In research
R (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses R (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
R (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Array programming languages, Cross-platform free software, Data-centric programming languages, so understanding it makes those chapters shorter.
In everyday life
Look for R (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study R (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what R (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain R (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is R (programming language) in simple terms?

R is a programming language for statistical computing and data visualization. It has been widely adopted in the fields of data mining, bioinformatics, data analysis, and data science.

Why does R (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study R (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on R (programming language).

Tags

  • Array programming languages
  • Cross-platform free software
  • Data-centric programming languages
  • Data mining and machine learning software
  • Dynamically typed programming languages
  • Free plotting software
  • Free statistical software
  • Functional languages
  • GNU Project software
  • Literate programming
  • Numerical analysis software for Linux
  • Numerical analysis software for Windows

Keep exploring