Learn R

R is a free, open-source programming language purpose-built for statistical analysis, data visualization, and data science work.

What Is R?

R is a programming language and software environment designed for statistical computing and graphics. It was created in the early 1990s by Ross Ihaka and Robert Gentleman at the University of Auckland as an open alternative to the commercial S language, and it has since grown into one of the most widely used tools for working with data.

Unlike general-purpose languages that treat data analysis as one use case among many, R was designed around vectors, data frames, and statistical functions from the start, so tasks like computing an average, fitting a model, or drawing a chart usually take just one line of code.

  • Cleaning and transforming raw data
  • Running statistical tests and models
  • Creating charts, plots, and dashboards
  • Building reproducible data analysis reports
  • Automating repetitive data tasks

Why Data Professionals Choose R

  • It is completely free and open source
  • CRAN hosts tens of thousands of add-on packages for almost any analytical need
  • Its plotting system produces publication-quality graphics
  • A large, active community answers questions and shares packages
  • It pairs naturally with RStudio, a free development environment
FieldHow R Is Used
FinanceRisk modeling, portfolio analysis, forecasting
Biology & MedicineGenomics, clinical trial statistics, bioinformatics pipelines
AcademiaResearch statistics, published reproducible analysis
GovernmentCensus data, public health reporting, economic indicators
JournalismData-driven reporting and interactive graphics

Example

x <- c(4, 8, 15, 16, 23, 42)
print(mean(x))
Note: R is case-sensitive: a variable named age and one named Age are two completely different variables.

R Is Interpreted, Not Compiled

You do not need to compile R code before running it. Each line is read and executed by the R interpreter as soon as you run it, which makes R well suited to exploring data interactively — you can try an idea, see the result immediately, and adjust.

Note: R itself is just the language and engine. Most people write R code inside RStudio, a separate application that adds a code editor, console, plot viewer, and package manager around it.

Exercise: R Introduction

What type of programming language is R primarily designed for?

Frequently Asked Questions

Should I learn R or Python for data work?
Python if you want a general-purpose language that also does data, or if the work touches engineering and machine learning. R if the work is statistics-heavy, especially in academia, epidemiology or biostatistics, where its modelling packages and visualisation tools are unmatched.
Is R hard to learn?
The basics come quickly because R was designed for analysis rather than software engineering, so loading a dataset and plotting it takes very few lines. The awkwardness appears later, in its unusual object systems and inconsistencies inherited from a long history.
What is the tidyverse?
A family of R packages that share a consistent design for data manipulation and plotting, including dplyr and ggplot2. Most modern R teaching uses it, because its code reads more predictably than base R for everyday analysis tasks.