Tibbles are simple data tables and the primary way of representing data (in rows of cases and columns of variables) in the tidyverse (Wickham, 2019c). In this chapter, we examined essential commands of the tibble package (Müller & Wickham, 2019):
as_tibble()converts (or coerces) an existing rectangle of data (e.g., a data frame or matrix) into a tibble.
tibble()converts several vectors into (the columns of) a tibble.
tribble()converts a table (entered row-by-row) into a tibble.
Thus, the three commands differ by the types of inputs they expect, but have in common that they create a tibble as their output.
While some R veterans may prefer data frames, tibbles are becoming increasingly popular.
But if we ever need to transform a tibble
tb into a data frame, we can always use
By working through this chapter, you are now able to use tibble commands to:
- turn rectangular data into a tibble;
- turn vectors of variables into (the columns of) a tibble;
- turn cases into (the rows of) a tibble;
- enter some data into a tibble; and
- understand some limitations of rectangular data.
The relation between tibbles and data frames and key tibble commands are summarized on the back of the RStudio cheatsheet on Data Import:
Let’s test our knowledge and skills concerning tibbles by completing the following exercises.