<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/tibble-1-2-0/"></div></div><div><a data-url="https://www.r-bloggers.com/tibble-1-2-0/" data-counturl="https://www.r-bloggers.com/tibble-1-2-0/" data-count="horizontal" data-text="tibble 1.2.0" 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/08/29/tibble-1-2-0/"> RStudio Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>We’re proud to announce version 1.2.0 of the tibble 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>This is mostly a maintenance release, with the following major changes:</p>
<ul>
<li>More options for adding individual rows and (new!) columns</li>
<li>Improved function names</li>
<li>Minor 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.2">release notes</a> for a complete list.</p>
<p>Thanks to <a target="_blank" href="https://github.com/jennybc">Jenny Bryan</a> for <code>add_row()</code> and <code>add_column()</code> improvements and ideas, to <a target="_blank" href="https://github.com/BillDunlap">William Dunlap</a> for pointing out a bug with tibble’s implementation of <code>all.equal()</code>, to <a target="_blank" href="https://github.com/kwstat">Kevin Wright</a> for pointing out a rare bug with <code>glimpse()</code>, and to all the other contributors. Use the <a target="_blank" href="https://github.com/hadley/tibble/issues">issue tracker</a> to submit bugs or suggest ideas, your contributions are always welcome.</p>
<div>
<h2>Adding rows and columns</h2>
<p>There are now more options for adding individual rows, and columns can be added in a similar way, illustrated with this small tibble:</p>
<pre><code>df &lt;- tibble(x = 1:3, y = 3:1)
df
#> # A tibble: 3 × 2
#>       x     y
#>   &lt;int> &lt;int>
#> 1     1     3
#> 2     2     2
#> 3     3     1</code></pre>
<p>The <code>add_row()</code> function allows control over where the new rows are added. In the following example, the row (4, 0) is added before the second row:</p>
<pre><code>df %>% 
  add_row(x = 4, y = 0, .before = 2)
#> # A tibble: 4 × 2
#>       x     y
#>   &lt;dbl> &lt;dbl>
#> 1     1     3
#> 2     4     0
#> 3     2     2
#> 4     3     1</code></pre>
<p>Adding more than one row is now fully supported, although not recommended in general because it can be a bit hard to read.</p>
<pre><code>df %>% 
  add_row(x = 4:5, y = 0:-1)
#> # A tibble: 5 × 2
#>       x     y
#>   &lt;int> &lt;int>
#> 1     1     3
#> 2     2     2
#> 3     3     1
#> 4     4     0
#> 5     5    -1</code></pre>
<p>Columns can now be added in much the same way with the new <code>add_column()</code> function:</p>
<pre><code>df %>% 
  add_column(z = -1:1, w = 0)
#> # A tibble: 3 × 4
#>       x     y     z     w
#>   &lt;int> &lt;int> &lt;int> &lt;dbl>
#> 1     1     3    -1     0
#> 2     2     2     0     0
#> 3     3     1     1     0</code></pre>
<p>It also supports <code>.before</code> and <code>.after</code> arguments:</p>
<pre><code>df %>% 
  add_column(z = -1:1, .after = 1)
#> # A tibble: 3 × 3
#>       x     z     y
#>   &lt;int> &lt;int> &lt;int>
#> 1     1    -1     3
#> 2     2     0     2
#> 3     3     1     1

df %>%  
  add_column(w = 0:2, .before = &quot;x&quot;)
#> # A tibble: 3 × 3
#>       w     x     y
#>   &lt;int> &lt;int> &lt;int>
#> 1     0     1     3
#> 2     1     2     2
#> 3     2     3     1</code></pre>
<p>The <code>add_column()</code> function will never alter your existing data: you can’t overwrite existing columns, and you can’t add new observations.</p>
</div>
<div>
<h2>Function names</h2>
<p><code>frame_data()</code> is now <code>tribble()</code>, which stands for “transposed tibble”. The old name still works, but will be deprecated eventually.</p>
<pre><code>tribble(
  ~x, ~y,
   1, &quot;a&quot;,
   2, &quot;z&quot;
)
#> # A tibble: 2 × 2
#>       x     y
#>   &lt;dbl> &lt;chr>
#> 1     1     a
#> 2     2     z</code></pre>
</div>
<div>
<h2>Output tweaks</h2>
<p>We’ve tweaked the output again to use the multiply character <code>×</code> instead of <code>x</code> when printing dimensions (this still renders nicely on Windows.) We surround non-semantic column with backticks, and <code>dttm</code> is now used instead of <code>time</code> to distinguish <code>POSIXt</code> and <code>hms</code> (or <code>difftime</code>) values.</p>
<p>The example below shows the new rendering:</p>
<pre><code>tibble(`date and time` = Sys.time(), time = hms::hms(minutes = 3))
#> # A tibble: 1 × 2
#>       `date and time`     time
#>                &lt;dttm>   &lt;time>
#> 1 2016-08-29 16:48:57 00:03:00</code></pre>
<p>Expect the printed output to continue to evolve in next release. Stay tuned for a new function that reconstructs <code>tribble()</code> calls from existing data frames.</p>
</div>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rstudioblog.wordpress.com/3076/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/rstudioblog.wordpress.com/3076/" border="0"></a> <img alt="" src="https://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="https://www.r-bloggers.com/tibble-1-2-0/"></div></div><div><a data-url="https://www.r-bloggers.com/tibble-1-2-0/" data-counturl="https://www.r-bloggers.com/tibble-1-2-0/" data-count="vertical" data-text="tibble 1.2.0" 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/08/29/tibble-1-2-0/"> RStudio Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://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="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/f3WaF85rk5Q"></a></div>