Tibbles (Modern Data Frames)
A tibble is the tidyverse's modern reimagining of the data frame — a rectangular table that prints compactly, never silently changes your data's type, and never partial-matches a column name.
Learn Tibbles (Modern Data Frames) in our free R course — a beginner-friendly interactive lesson with worked examples, a practice exercise and a quick…
Part of the free R course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
In this lesson you'll build tibbles with tibble() , see how they differ from data.frame() , convert existing data with as_tibble() , and meet list columns — the feature that powers advanced tidyverse workflows.
What You'll Learn in This Lesson
1️⃣ Building a Tibble
You create a tibble with tibble() , passing one named argument per column. Each column is an ordinary vector, and all columns must be the same length (length-1 values are recycled). When you print it, a tibble shows the dimensions, the column names, and — crucially — the type of each column ( <chr> for character, <dbl> for double).
A neat bonus: tibble() evaluates its arguments in order, so you can build a column from columns defined earlier in the same call.
2️⃣ No Surprises: Types & Names
Two long-standing data-frame gotchas disappear with tibbles. First, tibbles never coerce a character column into a factor — what you type is what you get. (Old R turned strings into factors unless you set stringsAsFactors = FALSE ; this was the default until R 4.0.) Second, tibbles disable partial matching of column names, so a typo returns NULL with a warning instead of silently handing you the wrong column.
These guarantees matter most in scripts you run unattended: a silent factor conversion or a partial-match typo can corrupt an analysis without raising an error. Tibbles fail loudly so you catch problems early.
3️⃣ Converting & List Columns
You rarely have to start from scratch. as_tibble() upgrades any existing data frame, and because tibbles don't use row names, you can capture them into a real column with the rownames = argument.
The most distinctive tibble feature is the list column : a column whose cells each hold a list element — a vector, a data frame, even a model. Tibbles print these cleanly, which is why they underpin nested, "many models" workflows.
Your turn. Fill in the # TODO blank, run it, and confirm the column types print.
Build the same dataset two ways and compare. This is the fastest way to feel the difference in printing, type handling, and strictness for yourself.
📋 Quick Reference — Tibbles
Practice quiz
What is a tibble?
- A base R matrix
- A named list only
- The tidyverse's modern data frame
- A plotting function
Answer: The tidyverse's modern data frame. A tibble is the tidyverse's enhanced data frame from the tibble package.
What class does a tibble have?
- Only "data.frame"
- Only "matrix"
- "list" alone
- c("tbl_df", "tbl", "data.frame")
Answer: c("tbl_df", "tbl", "data.frame"). A tibble IS a data frame with extra classes layered on top.
How many rows does a tibble print by default?
- The first 10
- All of them
- Just 1
- 100
Answer: The first 10. A tibble prints only the first 10 rows plus a summary, to avoid flooding the console.
What does a tibble show under each column name when printed?
- The row count
- The column type, e.g. <chr> or <dbl>
- Nothing
- The mean
Answer: The column type, e.g. <chr> or <dbl>. Tibbles print the type tag (<chr>, <dbl>) beneath each column name.
How do tibbles handle character columns compared to old data.frame()?
- They drop them
- They sort them
- They never coerce them to factors
- They convert them to numbers
Answer: They never coerce them to factors. Tibbles keep characters as characters; no silent factor conversion.
What happens with partial column-name matching on a tibble (e.g. tib$gr for 'grade')?
- It returns 'grade'
- It errors fatally
- It renames the column
- It returns NULL with a warning (no partial match)
Answer: It returns NULL with a warning (no partial match). Tibbles disable partial matching, so a typo returns NULL with a warning.
Which function converts an existing data frame into a tibble?
- as_tibble()
- make.tibble()
- tibble.cast()
- to_tbl()
Answer: as_tibble(). as_tibble() upgrades a data frame (or matrix) to a tibble.
How do you convert a tibble back to a plain data frame?
- unframe()
- as.data.frame()
- untibble()
- base()
Answer: as.data.frame(). as.data.frame() turns a tibble back into a base data frame.
What is a list column in a tibble?
- A column of column names
- A factor column
- A column of NA values
- A column whose cells each hold a list element (vector, frame, or model)
Answer: A column whose cells each hold a list element (vector, frame, or model). List columns store one list element per row, powering nested workflows.
Can you reference a column you just defined within the same tibble() call?
- Yes — tibble() evaluates arguments in order
- No, never
- Only with data.frame()
- Only for numeric columns
Answer: Yes — tibble() evaluates arguments in order. tibble() lets later columns use earlier ones; base data.frame() cannot.