EVOLUTION-MANAGER
Edit File: tbl_df-class.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: 'tbl_df' class</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for tbl_df-class {tibble}"><tr><td>tbl_df-class {tibble}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2><code>tbl_df</code> class</h2> <h3>Description</h3> <p>The <code>tbl_df</code> class is a subclass of <code><a href="../../base/html/data.frame.html">data.frame</a></code>, created in order to have different default behaviour. The colloquial term "tibble" refers to a data frame that has the <code>tbl_df</code> class. Tibble is the central data structure for the set of packages known as the <a href="https://www.tidyverse.org/packages/">tidyverse</a>, including <a href="https://dplyr.tidyverse.org/">dplyr</a>, <a href="https://ggplot2.tidyverse.org/">ggplot2</a>, <a href="https://tidyr.tidyverse.org/">tidyr</a>, and <a href="https://readr.tidyverse.org/">readr</a>. </p> <p>The general ethos is that tibbles are lazy and surly: they do less and complain more than base <a href="../../base/html/data.frame.html">data.frame</a>s. This forces problems to be tackled earlier and more explicitly, typically leading to code that is more expressive and robust. </p> <h3>Properties of <code>tbl_df</code></h3> <p>Objects of class <code>tbl_df</code> have: </p> <ul> <li><p> A <code>class</code> attribute of <code>c("tbl_df", "tbl", "data.frame")</code>. </p> </li> <li><p> A base type of <code>"list"</code>, where each element of the list has the same <code><a href="../../vctrs/html/vec_size.html">vctrs::vec_size()</a></code>. </p> </li> <li><p> A <code>names</code> attribute that is a character vector the same length as the underlying list. </p> </li> <li><p> A <code>row.names</code> attribute, included for compatibility with <a href="../../base/html/data.frame.html">data.frame</a>. This attribute is only consulted to query the number of rows, any row names that might be stored there are ignored by most tibble methods. </p> </li></ul> <h3>Behavior of <code>tbl_df</code></h3> <p>How default behaviour of tibbles differs from that of <a href="../../base/html/data.frame.html">data.frame</a>s, during creation and access: </p> <ul> <li><p> Column data is not coerced. A character vector is not turned into a factor. List-columns are expressly anticipated and do not require special tricks. Internal names are never stripped from column data. Read more in <code><a href="tibble.html">tibble()</a></code>. </p> </li> <li><p> Recycling only happens for a length 1 input. Read more in <code><a href="../../vctrs/html/vec_recycle.html">vctrs::vec_recycle()</a></code>. </p> </li> <li><p> Column names are not munged, although missing names are auto-populated. Empty and duplicated column names are strongly discouraged, but the user must indicate how to resolve. Read more in <code><a href="../../vctrs/html/vec_as_names.html">vctrs::vec_as_names()</a></code>. </p> </li> <li><p> Row names are not added and are strongly discouraged, in favor of storing that info as a column. Read about in <a href="rownames.html">rownames</a>. </p> </li> <li> <p><code>df[, j]</code> returns a tibble; it does not automatically extract the column inside. <code>df[, j, drop = FALSE]</code> is the default. Read more in <a href="subsetting.html">subsetting</a>. </p> </li> <li><p> There is no partial matching when <code>$</code> is used to index by name. <code>df$name</code> for a nonexistent name generates a warning. Read more in <a href="subsetting.html">subsetting</a>. </p> </li></ul> <p>See <code>vignette("invariants")</code> for a detailed description of the behavior. </p> <p>Furthermore, printing and inspection are a very high priority. The goal is to convey as much information as possible, in a concise way, even for large and complex tibbles. Read more in <a href="formatting.html">formatting</a>. </p> <h3>See Also</h3> <p><code><a href="tibble.html">tibble()</a></code>, <code><a href="as_tibble.html">as_tibble()</a></code>, <code><a href="tribble.html">tribble()</a></code>, <code><a href="formatting.html">print.tbl()</a></code>, <code><a href="reexports.html">glimpse()</a></code> </p> <hr /><div style="text-align: center;">[Package <em>tibble</em> version 3.1.8 <a href="00Index.html">Index</a>]</div> </body></html>