# tibble ## Overview A **tibble**, or `tbl_df`, is a modern reimagining of the data.frame, keeping what time has proven to be effective, and throwing out what is not. Tibbles are data.frames that are lazy and surly: they do less (i.e. they don’t change variable names or types, and don’t do partial matching) and complain more (e.g. when a variable does not exist). This forces you to confront problems earlier, typically leading to cleaner, more expressive code. Tibbles also have an enhanced [`print()`](https://rdrr.io/r/base/print.html) method which makes them easier to use with large datasets containing complex objects. If you are new to tibbles, the best place to start is the [tibbles chapter](https://r4ds.had.co.nz/tibbles.html) in *R for data science*. ## Installation ``` r # The easiest way to get tibble is to install the whole tidyverse: install.packages("tidyverse") # Alternatively, install just tibble: install.packages("tibble") # Or the the development version from GitHub: # install.packages("pak") pak::pak("tidyverse/tibble") ``` ## Usage ``` r library(tibble) ``` Create a tibble from an existing object with [`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.md): ``` r data <- data.frame(a = 1:3, b = letters[1:3], c = Sys.Date() - 1:3) data #> a b c #> 1 1 a 2025-06-18 #> 2 2 b 2025-06-17 #> 3 3 c 2025-06-16 as_tibble(data) #> # A tibble: 3 × 3 #> a b c #> #> 1 1 a 2025-06-18 #> 2 2 b 2025-06-17 #> 3 3 c 2025-06-16 ``` This will work for reasonable inputs that are already data.frames, lists, matrices, or tables. You can also create a new tibble from column vectors with [`tibble()`](https://tibble.tidyverse.org/reference/tibble.md): ``` r tibble(x = 1:5, y = 1, z = x^2 + y) #> # A tibble: 5 × 3 #> x y z #> #> 1 1 1 2 #> 2 2 1 5 #> 3 3 1 10 #> 4 4 1 17 #> 5 5 1 26 ``` [`tibble()`](https://tibble.tidyverse.org/reference/tibble.md) does much less than [`data.frame()`](https://rdrr.io/r/base/data.frame.html): it never changes the type of the inputs (e.g. it keeps list columns as is), it never changes the names of variables, it only recycles inputs of length 1, and it never creates [`row.names()`](https://rdrr.io/r/base/row.names.html). You can read more about these features in [`vignette("tibble")`](https://tibble.tidyverse.org/articles/tibble.md). You can define a tibble row-by-row with [`tribble()`](https://tibble.tidyverse.org/reference/tribble.md): ``` r tribble( ~x, ~y, ~z, "a", 2, 3.6, "b", 1, 8.5 ) #> # A tibble: 2 × 3 #> x y z #> #> 1 a 2 3.6 #> 2 b 1 8.5 ``` ## Related work The tibble print method draws inspiration from [data.table](https://rdatatable.gitlab.io/data.table), and [frame](https://github.com/patperry/r-frame). Like `data.table::data.table()`, [`tibble()`](https://tibble.tidyverse.org/reference/tibble.md) doesn’t change column names and doesn’t use rownames. # Package index ## Tibbles - [`tibble-package`](https://tibble.tidyverse.org/reference/tibble-package.md) : tibble: Simple Data Frames - [`tibble()`](https://tibble.tidyverse.org/reference/tibble.md) [`tibble_row()`](https://tibble.tidyverse.org/reference/tibble.md) : Build a data frame - [`tbl_df-class`](https://tibble.tidyverse.org/reference/tbl_df-class.md) [`tbl_df`](https://tibble.tidyverse.org/reference/tbl_df-class.md) : `tbl_df` class - [`print(`*``*`)`](https://tibble.tidyverse.org/reference/formatting.md) [`format(`*``*`)`](https://tibble.tidyverse.org/reference/formatting.md) : Printing tibbles - [`num()`](https://tibble.tidyverse.org/reference/num.md) [`set_num_opts()`](https://tibble.tidyverse.org/reference/num.md) **\[experimental\]** : Format a numeric vector - [`char()`](https://tibble.tidyverse.org/reference/char.md) [`set_char_opts()`](https://tibble.tidyverse.org/reference/char.md) **\[experimental\]** : Format a character vector - [`tibble_options`](https://tibble.tidyverse.org/reference/tibble_options.md) : Package options - [`tribble()`](https://tibble.tidyverse.org/reference/tribble.md) : Row-wise tibble creation ## Coercion - [`is_tibble()`](https://tibble.tidyverse.org/reference/is_tibble.md) : Test if the object is a tibble - [`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.md) [`as_tibble_row()`](https://tibble.tidyverse.org/reference/as_tibble.md) [`as_tibble_col()`](https://tibble.tidyverse.org/reference/as_tibble.md) : Coerce lists, matrices, and more to data frames - [`new_tibble()`](https://tibble.tidyverse.org/reference/new_tibble.md) [`validate_tibble()`](https://tibble.tidyverse.org/reference/new_tibble.md) : Tibble constructor and validator - [`enframe()`](https://tibble.tidyverse.org/reference/enframe.md) [`deframe()`](https://tibble.tidyverse.org/reference/enframe.md) : Converting vectors to data frames, and vice versa ## Manipulation - [`` `$`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) [`` `[[`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) [`` `[`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) [`` `$<-`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) [`` `[[<-`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) [`` `[<-`( ``*``*`)`](https://tibble.tidyverse.org/reference/subsetting.md) : Subsetting tibbles - [`add_row()`](https://tibble.tidyverse.org/reference/add_row.md) : Add rows to a data frame - [`add_column()`](https://tibble.tidyverse.org/reference/add_column.md) : Add columns to a data frame ## Helpers - [`reexports`](https://tibble.tidyverse.org/reference/reexports.md) [`glimpse`](https://tibble.tidyverse.org/reference/reexports.md) [`has_name`](https://tibble.tidyverse.org/reference/reexports.md) [`%>%`](https://tibble.tidyverse.org/reference/reexports.md) [`tbl_sum`](https://tibble.tidyverse.org/reference/reexports.md) [`obj_sum`](https://tibble.tidyverse.org/reference/reexports.md) [`type_sum`](https://tibble.tidyverse.org/reference/reexports.md) [`size_sum`](https://tibble.tidyverse.org/reference/reexports.md) : Objects exported from other packages - [`has_rownames()`](https://tibble.tidyverse.org/reference/rownames.md) [`remove_rownames()`](https://tibble.tidyverse.org/reference/rownames.md) [`rownames_to_column()`](https://tibble.tidyverse.org/reference/rownames.md) [`rowid_to_column()`](https://tibble.tidyverse.org/reference/rownames.md) [`column_to_rownames()`](https://tibble.tidyverse.org/reference/rownames.md) : Tools for working with row names - [`view()`](https://tibble.tidyverse.org/reference/view.md) **\[experimental\]** : View an object ## Vectors, matrices, and lists - [`enframe()`](https://tibble.tidyverse.org/reference/enframe.md) [`deframe()`](https://tibble.tidyverse.org/reference/enframe.md) : Converting vectors to data frames, and vice versa - [`lst()`](https://tibble.tidyverse.org/reference/lst.md) : Build a list - [`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.md) [`as_tibble_row()`](https://tibble.tidyverse.org/reference/as_tibble.md) [`as_tibble_col()`](https://tibble.tidyverse.org/reference/as_tibble.md) : Coerce lists, matrices, and more to data frames - [`frame_matrix()`](https://tibble.tidyverse.org/reference/frame_matrix.md) : Row-wise matrix creation # Articles ### Get started - [Tibbles](https://tibble.tidyverse.org/articles/tibble.md): ### Basics - [Column types](https://tibble.tidyverse.org/articles/types.md): - [Controlling display of numbers](https://tibble.tidyverse.org/articles/numbers.md): - [Comparing display with data frames](https://tibble.tidyverse.org/articles/digits.md): ### Developer - [Extending tibble](https://tibble.tidyverse.org/articles/extending.md): - [Invariants: Comparing behavior with data frames](https://tibble.tidyverse.org/articles/invariants.md): - [Column formats](https://tibble.tidyverse.org/articles/formats.md): ### WIP - [Subsetting](https://tibble.tidyverse.org/articles/wip/subset.md): - [Subassignment](https://tibble.tidyverse.org/articles/wip/subassign.md):