16

From version 1.4.1, tibble print method seems to be using additional formatting implemented by the pillar package (https://rdrr.io/cran/tibble/f/NEWS.md). The latter tries to output as many columns as possible, shortening some of the values. Is it possible to disable this formatting and go back to the print method that existed before? In some cases, by outputting the extra columns and shortening the values, pillar makes it difficult to read the contents of the first columns, which is often the analyst's intention.

It is difficult to provide a reproducible example, since the output and formatting would depend, I imagine, on the specifics of your particular display. I hope the question is straightforward enough as it is: how to disable pillar formatting of tibble printing (e.g. in console).

EDIT: The same question has been posited on tibble github repository: https://github.com/tidyverse/tibble/issues/361#issuecomment-357233716. It would seem that currently it is not really possible to disable the formatting. It is possible to provide some options, and the dev version of the package (at the time of this writing) does do a much better job of formatting. However, it is still not perfect, and may truncate important information (also see the issue the github discussion relates to). Therefore disabling the formatting is still something some users might want to achieve.

Maxim.K
  • 4,120
  • 1
  • 26
  • 43
  • Maybe `my_tibble %>% as.data.frame` – G. Grothendieck Jan 09 '18 at 10:49
  • 1
    @G.Grothendieck Thanks. It would be nice to keep the neat tibble output, though. – Maxim.K Jan 09 '18 at 12:50
  • 2
    It looks like the new dev version of `pillar` [adds options](https://twitter.com/krlmlr/status/951385697780486144) to change tibble output. – dshkol Jan 12 '18 at 08:06
  • The trunc_mat function is still there. Does it do what you are looking for `trunc_mat(mytibble, n=12,width=Inf)` The help is in `??format.tbl` – R.S. Jan 12 '18 at 08:17
  • This is a better example: `trunc_mat(as_tibble(mtcars), n=12,n_extra = -1, width=Inf)` – R.S. Jan 12 '18 at 08:21
  • Since "tbl_df"'s inherit from "data.frame", why not just use `print.data.frame`? – IRTFM Jan 13 '18 at 23:54
  • 1
    @42- The data frame print method is messy, and using it is certainly a step back from the neat tibble philosophy. – Maxim.K Jan 14 '18 at 14:28

1 Answers1

9

With the development version of package pillar (with devtools::install_github("r-lib/pillar")), you can change options of the tibble formatting (see http://pillar.r-lib.org/reference/pillar-package.html#package-options).

If you change the options in your Rprofile, this will be permanent.

F. Privé
  • 11,423
  • 2
  • 27
  • 78