R
In short
R is a programming language and environment for statistics and data analysis, widely used in research for data visualization, statistical models and reports.
What is the R programming language?
R is a programming language and interactive environment built for statistical computing and graphics. It was created by Ross Ihaka and Robert Gentleman at the University of Auckland, first appeared in 1993 and is based on the earlier S language from Bell Labs. R is free and open source, part of the GNU project, and extended by thousands of community packages in the CRAN repository.
R is dynamically typed and vectorized, meaning operations work on whole vectors of values at once: c(1, 2, 3) * 2 returns 2 4 6 without a loop. Its central data structure is the data frame, a table where each column can hold a different type, which makes it natural for spreadsheet-like data. R counts from 1 instead of 0, and many users assign values with the <- arrow rather than =.
R is used by statisticians, data scientists and researchers in fields such as biology, medicine, economics and social science for exploring data, fitting statistical models, making publication-quality charts and producing reproducible reports that mix code and text. Working in R feels like walking into a well-equipped statistics lab: the tools for tests, regressions and plots are already on the bench instead of needing to be assembled first.
R is most often compared with Python for data work. Python is a general-purpose language that also has strong data libraries and dominates machine learning and production systems, while R is specialized for statistics, with a deeper catalog of statistical methods and very polished visualization tools. Many teams use both, and each can call the other through bridging packages.
Key takeaways
- R is designed specifically for statistics, data analysis and graphics.
- Operations are vectorized, so they apply to whole vectors without explicit loops.
- Data frames are its core structure for tabular data.
- CRAN hosts thousands of free packages that extend R.
- Compared with Python, R is more specialized for statistics and less for general software.
Example
# A data frame: a table whose columns are vectors
scores <- data.frame(
student = c("Ada", "Grace", "Linus", "Margaret"),
score = c(91, 78, 85, 96)
)
mean(scores$score) # 87.5
scores$passed <- scores$score >= 80 # vectorized comparison, no loop
subset(scores, passed) # rows where passed is TRUE
# Summary statistics and a quick chart
summary(scores$score)
barplot(scores$score, names.arg = scores$student)Readers ask
Is R a real programming language?
Yes. R has functions, loops, packages and several object systems, so it can express any program, but its design and libraries are centered on statistics and data analysis rather than general application development.
Should I learn R or Python for data science?
Python is more general-purpose and dominates machine learning and production code, while R excels at statistics, research and visualization. If you work mainly in academic research or statistics, R is a strong choice; otherwise Python is usually more versatile.
Why is it called R?
The name is partly a nod to its predecessor, the S language, and partly a reference to the first names of its creators, Ross Ihaka and Robert Gentleman.
See also
- PythonProgramming Languages, p. 26Python is a general-purpose, dynamically typed programming language known for readable syntax and wide use in data science, automation, and web backends.
- Machine LearningAI & Machine Learning, p. 27Machine learning is a branch of artificial intelligence in which computers learn patterns from data to make predictions instead of following hand-written rules.
- ArrayProgramming Fundamentals, p. 3An array is an ordered collection of values stored under one name, where each item is accessed by its numeric position, called an index, usually starting at 0.
- Data TypeProgramming Fundamentals, p. 14A data type is a classification that tells a program what kind of value a piece of data holds, such as a number or text, and which operations work on it.
- Functional ProgrammingProgramming Fundamentals, p. 22Functional programming is a style of building software from pure functions that avoid changing shared data, making code more predictable and easier to test.
- JuliaProgramming Languages, p. 16Julia is a high-level, dynamically typed language for scientific and numerical computing, designed to be as easy to write as Python and as fast as C.
Spotted a mistake or something missing on this page?Suggest an edit