install.packages("tidyverse")
Welcome to the tibble Package!
A tibble, or tbl_df
, is a modern re-imagining of the data.frame
, keeping what time has proven to be effective, and throwing out the obsolete features. While similar to data.frame
, it has important improvements to provide enhanced printing for large and complex datasets, and to help create cleaner and more expressive code.
The tibble structure is the central data structure for the set of packages known as the tidyverse, including dplyr, ggplot2, tidyr, and readr. Most datasets in this website’s R tutorials are displayed in the tibble format.
The easiest way to get the tibble package is to install the whole tidyverse.
Alternatively, you can install just the tibble package.
install.packages("tibble")
In the following tutorials, we’ll cover the most used functions in the tibble package:
Printing tibbles. Improved printing method is one of its most striking improvements compared with traditional data.frame.
Create tibbles from scratch, using
tibble()
(column-wise) ortribble()
(row-wise, a more readable style).Convert various data types (e.g., data.frame, matrix, vector and list) to tibbles.
as_tibble()
is the most used. There are other convenient functions for special cases, includingas_tibble_col()
andas_tibble_row()
, andenframe()
(along with its opposite operationdeframe()
).Modify a tibble by adding additional rows with
add_row()
, or add additional columns withadd_column()
.
Now, let’s dive into the details of each of these powerful functions!