Skip to Main Content
| University Libraries
See Updates and FAQs for the latest library services updates. Subject Librarians are available for online appointments, and Virtual Reference has extended hours.

Learn R

Resources to learn and use the Open Source Statistical software R (R-Project)

The R Project for Statistical Computing is a free, open source statistical computing language that is popular among researchers in many fields. 

The learning curve for true understanding is steep, but specific tasks (e.g., importing files from other statistical software) are often quite easy because of packages that can be created by anybody. R undergoes rapid development and improvement. Tutorials even a year old may be out of date

Note that RStudio is currently in the process of changing names to Posit. Various tutorials may reference one or the other, but both are acceptable at this time.

  • R for Data Management
  • R for Statistical Analysis
  • R for Data Visualization

See the slides from our Getting Started with R (pdf) workshop for an overview and recommendations.

Foundational Concepts

Are you having trouble with R? 

Make sure you know the basic concepts and terminology that are often not taught in classes. These are short overviews of particular topics that you need to. Check the comprehensive resources for more information.

Functions

Functions in R are the same as those in any programing language, in Algebra, or in Excel. Look for a word followed by parentheses.

Videos: Functions (~1min) and Arguments (~2min, RStudio) or Using Functions (~4min, Intro 2R)
Text: Call a function on a number or Run a Function (Posit Recipies) or Functions (R4Epis)

Packages are the code for groups of functions. You must download them to your computer and load them into R to use them.

Videos: Installing Packages (~2min, RStudio) or Installing R Packages (~4min, Intro 2R)

The Pipe ( |>  or  %>%) is a way to "chain" functions to avoid nesting parentheses and improve workflow.

Video: Pipe (~5min) (LinkedIn Learning - Log in with Mason)

 

Objects

Some languages (and tutorials) call these "variables", but R's term is "objects" to avoid confusion with data variables.(columns in tabular data). It is a name (word) that represents some data, whether a single value, a group of values, or an entire dataset.

Videos: Objects in R (~3min, Intro 2R)
Text: Objects (R4Eips) - Includes the topics below.

Objects have structures (is it a group of values or a data table?), and types or classes (is it numbers or letters?).

Start Here

RStudio = Posit (the company is changing names)

Installation

Video walk-through specifically for Windows or Mac (OpenIntro)

  • NOTE: The RStudio / Posit website undergoes frequent changes so the process of downloading RStudio will be slightly different. But, the links/buttons use the same names (and have blue backgrounds to stand out).
  • See also the interactive Setup Tutorial
    • Install R
    • Install RStudio
    • Install Packages

Comprehensive Resources

Solutions to Exercises

This book is one of the best resources and good to either read or refer to. However, non-programmers who want help with the very first steps should look elsewhere.

Interface

  • Using RStudio  (~8min) (LinkedIn Learning - Log in with Mason)
  • Notebooks
    • Note: R Markdown documents look and work the same as Quarto documents. But, Quarto provides more features, including a visual editor and multi-language support. If your instructor asks you to use R Markdown, the Quarto video will still be useful. Or, you might politely ask your instructor if you can submit a Quarto document instead, as they may not know about this new feature.
    • Quarto Visual Editor [Part 1] (~10min, Andy Field)

Related Resources

Why R?

Why R?

How to Choose

  1. If you know other programing languages, Python will likely be easier to start with. 
  2. If you instead are familiar with statistical software, R will likely be easier to start with.
  3. If you are just starting out,
    • Pick R If you will mostly work with data tables and be in an academic context
    • Pick Python if you will work with text or websites and/or be in a business context

Many people will ultimately learn both. But, they are similar enough that you do not want to learn them at the same time--it can get confusing to switch back and forth. Knowing either one will help you learn the other. So, just pick one and get started!

Switching to R

Switching to R

If you already know another statistical software or programming language, you might try these first.