<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/tibble-1-1/"></div></div><div><a data-url="http://www.r-bloggers.com/tibble-1-1/" data-counturl="http://www.r-bloggers.com/tibble-1-1/" data-count="horizontal" data-text="tibble 1.1" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.rstudio.org/2016/07/05/tibble-1-1/"> RStudio Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>We’re proud to announce version 1.1 of the <code>tibble</code> package. Tibbles are a modern reimagining of the data frame, keeping what time has shown to be effective, and throwing out what is not. Grab the latest version with:</p>
<pre><code>install.packages(&quot;tibble&quot;)</code></pre>
<p>There are three major new features:</p>
<ul>
<li>A more consistent naming scheme</li>
<li>Changes to how columns are extracted</li>
<li>Tweaks to the output</li>
</ul>
<p>There are many other small improvements and bug fixes: please see the <a target="_blank" href="https://github.com/hadley/tibble/releases/tag/v1.1">release notes</a> for a complete list.</p>
<div>
<h2>A better naming scheme</h2>
<p>It’s caused some confusion that you use <code>data_frame()</code> and <code>as_data_frame()</code> to create and coerce tibbles. It’s also more important to make the distinction between tibbles and data frames more clear as we evolve a little further away from the semantics of data frames.</p>
<p>Now, we’re consistently using “tibble” as the key word in creation, coercion, and testing functions:</p>
<pre><code>tibble(x = 1:5, y = letters[1:5])
#> # A tibble: 5 x 2
#>       x     y
#>   &lt;int> &lt;chr>
#> 1     1     a
#> 2     2     b
#> 3     3     c
#> 4     4     d
#> 5     5     e
as_tibble(data.frame(x = runif(5)))
#> # A tibble: 5 x 1
#>           x
#>       &lt;dbl>
#> 1 0.4603887
#> 2 0.4824339
#> 3 0.4546795
#> 4 0.5042028
#> 5 0.4558387
is_tibble(data.frame())
#> [1] FALSE</code></pre>
<p>Previously <code>tibble()</code> was an alias for <code>frame_data()</code>. If you were using <code>tibble()</code> to create tibbles by rows, you’ll need to switch to <code>frame_data()</code>. This is a breaking change, but we believe that the new naming scheme will be less confusing in the long run.</p>
</div>
<div>
<h2>Extracting columns</h2>
<p>The previous version of tibble was a little too strict when you attempted to retrieve a column that did not exist: we had forgotten that many people check for the presence of column with <code>is.null(df$x)</code>. This is bad idea because of partial matching, but it is common:</p>
<pre><code>df1 &lt;- data.frame(xyz = 1)
df1$x
#> [1] 1</code></pre>
<p>Now, instead of throwing an error, tibble will return <code>NULL</code>. If you use <code>$</code>, common in interactive scripts, tibble will generate a warning:</p>
<pre><code>df2 &lt;- tibble(xyz = 1)
df2$x
#> Warning: Unknown column 'x'
#> NULL
df2[[&quot;x&quot;]]
#> NULL</code></pre>
<p>We also provide a convenient helper for detecting the presence/absence of a column:</p>
<pre><code>has_name(df1, &quot;x&quot;)
#> [1] FALSE
has_name(df2, &quot;x&quot;)
#> [1] FALSE</code></pre>
</div>
<div>
<h2>Output tweaks</h2>
<p>We’ve tweaked the output to have a shorter header, more information in the footer. We’re using <code>#</code> consistently to denote metadata, and we print missing character values as <code>&lt;NA></code> (instead of <code>NA</code>).</p>
<p>The example below shows the new rendering of the <code>flights</code> table.</p>
<pre><code>nycflights13::flights
#> # A tibble: 336,776 x 19
#>     year month   day dep_time sched_dep_time dep_delay arr_time
#>    &lt;int> &lt;int> &lt;int>    &lt;int>          &lt;int>     &lt;dbl>    &lt;int>
#> 1   2013     1     1      517            515         2      830
#> 2   2013     1     1      533            529         4      850
#> 3   2013     1     1      542            540         2      923
#> 4   2013     1     1      544            545        -1     1004
#> 5   2013     1     1      554            600        -6      812
#> 6   2013     1     1      554            558        -4      740
#> 7   2013     1     1      555            600        -5      913
#> 8   2013     1     1      557            600        -3      709
#> 9   2013     1     1      557            600        -3      838
#> 10  2013     1     1      558            600        -2      753
#> # ... with 336,766 more rows, and 12 more variables: sched_arr_time &lt;int>,
#> #   arr_delay &lt;dbl>, carrier &lt;chr>, flight &lt;int>, tailnum &lt;chr>,
#> #   origin &lt;chr>, dest &lt;chr>, air_time &lt;dbl>, distance &lt;dbl>, hour &lt;dbl>,
#> #   minute &lt;dbl>, time_hour &lt;time></code></pre>
<p>Thanks to <a target="_blank" href="http://github.com/lionel-">Lionel Henry</a> for contributing an option for determining the number of printed extra columns: <code>getOption(&quot;tibble.max_extra_cols&quot;)</code>. This is particularly important for the ultra-wide tables often released by statistical offices and other institutions.</p>
<p>Expect the printed output to continue to evolve. In the next version, we hope to do better with very wide columns (e.g. from long strings), and to make better use of now unused horizontal space (e.g. from long column names).</p>
</div>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rstudioblog.wordpress.com/2950/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/rstudioblog.wordpress.com/2950/" border="0"></a> <img alt="" src="http://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/tibble-1-1/"></div></div><div><a data-url="http://www.r-bloggers.com/tibble-1-1/" data-counturl="http://www.r-bloggers.com/tibble-1-1/" data-count="vertical" data-text="tibble 1.1" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://blog.rstudio.org/2016/07/05/tibble-1-1/"> RStudio Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/8MwnMj3CA6M"></a></div>