Lists in R

Interactive R tutorial on lists: build them, access elements with $ and [[ ]], edit entries, and pull values out of model results β€” all live in your browser.

A list is R’s mixed container β€” one object that can hold numbers, text and whole vectors side by side. Edit and Run each box.

Watch: lists in 90 seconds

Every step below β€” building, indexing and editing a list β€” run live in RStudio, then try each one in the consoles that follow.

Download the R script  Β·  β–Ά Practice in the playground β€” or edit and run each snippet below.

A list can hold anything

Unlike a vector, a list mixes types freely β€” and each entry can have a name:

Get elements with $ or [[ ]]

[ ] keeps a list, [[ ]] extracts the value

This distinction trips everyone exactly once:

Add, change and remove entries

Why lists matter: results are lists

Most R results β€” a t-test, a regression model β€” are lists, so you can pull out exactly the piece you need:

Your turn


Next: Matrices in R β†’ β€” a 2D grid of one type.