Tibble

Overview

A tibble (tbl) is a reimagining of the data.frame (df) object. They are described as data.frames that are:

  • Lazy: They don’t change variable names and they partial matching does not work.
  • Surly: They complain more such as when a variable does not exist.

One important note is that tibbles don’t have row names.

Although tibbles have advantages compared to data.frames they are not always more suited to the task than data.frames. However, tibbles are generally always preferred over data.frames when using tidyverse packages.

Tibble homepage

Sections

The sections in this book are:

Tibble example

Below is an example of:

  • Creating a basic tibble
  • Printing the tibble
#Create a tibble
tbl <- tibble::tibble(Day = c("Mon", "Tue", "Wed"),
              Hawks = c(3,7,2),
              Pigeons = c(52,21,61),
              Starlings = c(1,2,1))
#Print tibble
tbl
# A tibble: 3 × 4
  Day   Hawks Pigeons Starlings
  <chr> <dbl>   <dbl>     <dbl>
1 Mon       3      52         1
2 Tue       7      21         2
3 Wed       2      61         1