Skip to main content
v2026.11,858 entries · CC-BY 4.0

What Is R Programming Used For? Research Uses and First Steps

R is a language for statistical computing and graphics. See research uses by field, a first task with real commands, and free alternatives.

Written and maintained by CASRAI Editorial Board

Last updated

R is a language and environment for statistical computing and graphics, according to the R Project’s own description. Researchers use it to clean and summarise data, fit statistical models, run tests and draw publication-quality plots, usually from a script that can be re-run later. It is free software released under the GNU General Public License and runs on UNIX-like systems, Windows and macOS (R Project, About R, checked 2026-10-29).

What is R programming used for in research?

The manual An Introduction to R describes R as an integrated suite of software facilities for data manipulation, calculation and graphical display. In its words that means an effective data handling and storage facility, a suite of operators for calculations on arrays (in particular matrices), and graphical facilities for data analysis and display. R is also a programming language, with conditionals, loops and user-defined recursive functions (R Core Team, An Introduction to R, section 1.1, checked 2026-10-29).

Because R is highly extensible through add-on packages, most discipline-specific work happens in packages rather than in the base system. The Comprehensive R Archive Network (CRAN) publishes Task Views, which exist to give guidance on which CRAN packages are relevant to a given topic. They are curated lists by topic, not a ranking of the best packages. Views listed on the CRAN Task Views page (checked 2026-10-29) include:

  • Clinical research: ClinicalTrials, Survival, MetaAnalysis, Pharmacokinetics
  • Epidemiology and health data: Epidemiology, CausalInference, MissingData
  • Social science and economics: Econometrics, Psychometrics, OfficialStatistics
  • Statistical modelling: Bayesian, MixedModels, TimeSeries, ExperimentalDesign
  • Earth and life sciences: Spatial, Environmetrics, Phylogenetics, Omics
  • Method and workflow: ReproducibleResearch, NetworkAnalysis

For biological assay data there is a separate project. Bioconductor’s stated mission is to develop, support and disseminate free open source software that facilitates rigorous and reproducible analysis of data from current and emerging biological assays. Most of its components are distributed as R packages, and each Bioconductor release is designed to work with a specific version of R (Bioconductor, About, checked 2026-10-29).

What is RStudio used for?

RStudio is not R. R is the language and its computing engine. RStudio is a separate program, an editor and workspace you use to write and run R code. The CASRAI guide how to use RStudio covers its panes and workflow, so this page stays with R itself.

How to install or access R (official source only)

Get R from the R Project (r-project.org), which links to CRAN. The CRAN bin directory holds separate folders for linux, macos and windows builds, so pick the folder for your operating system and follow the instructions there. Do not install R from third-party download sites. To start R on a UNIX-like system, type R at the shell prompt; the manual notes that q() ends the session and offers to save the workspace.

A first task, step by step

This walk-through uses the faithful data set that ships with R and follows the worked example in section 8.2 of An Introduction to R (checked 2026-10-29).

  1. Start R. At the prompt, make the built-in data set’s columns available by name: attach(faithful)
  2. Summarise one variable: summary(eruptions)
  3. Draw a histogram of the same variable: hist(eruptions)
  4. Look up any function you do not know with help(solve) or ?solve. help.start() opens the HTML help in a browser, and ??solve searches the help system by keyword.
  5. To use your own data, read a plain-text file whose first line holds the variable names into a data frame: HousePrice <- read.table('houses.data', header=TRUE)

For your own analysis, keep the commands in a script file and run them with source('commands.R'). A saved script lets you re-run the same analysis later. See the CASRAI entry on computational reproducibility, and renv for recording which package versions a project used.

Output and how to read it

For summary(eruptions) the manual shows this output:

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.600   2.163   4.000   3.488   4.454   5.100 

These are the minimum, first quartile, median, mean, third quartile and maximum. Here the median (4.000) sits above the mean (3.488). The manual follows the summary with a stem-and-leaf display and a histogram. The histogram from hist(eruptions) shows how the values are spread across bins.

Troubleshooting

  • Columns come in shifted or mislabelled. When the first line of the file is a row of variable names, add header=TRUE to read.table, as in step 5.
  • Help for a symbol or reserved word returns an error. Put the name in quotes, for example help('[['). This is also needed for words such as if, for and function.
  • You do not know the function name. Search the help pages with ?? followed by a keyword, or browse by concept through help.start().
  • A package function is not found. Install the package with install.packages() and load it with library(). Bioconductor packages must match the Bioconductor release for your R version.

Free alternatives

Software What its own site says
Julia An open source project made available under the MIT license (julialang.org, checked 2026-10-29).
JASP A free, open-source project supported by the University of Amsterdam (jasp-stats.org, checked 2026-10-29).
jamovi A free and open statistical spreadsheet (jamovi.org, checked 2026-10-29).

For commercial comparisons, see SPSS vs R and R vs Stata. For a similar tool in a different ecosystem, see what MATLAB is used for.

FAQ

What is R programming used for?

Statistical computing and graphics: data handling, modelling, tests and plots, extended by add-on packages for each discipline.

Is R free?

Yes. R is free software under the GNU General Public License.

Is R the same as RStudio?

No. RStudio is a separate editor for writing and running R code, see how to use RStudio.

What is RStudio used for?

RStudio is an editor and workspace for writing and running R code; it is not the language itself. See how to use RStudio.

Where do I find packages for my field?

Start with the CRAN Task Views for your topic, or Bioconductor for biological assay data.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about What Is R Programming Used For? Research Uses and First Steps

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.