thie1e
thie1e

Reputation: 3688

Print tibble with column breaks as in v1.3.0

Using the latest version of tibble the output of wide tibbles is not properly displayed when setting width = Inf.

Based on my tests with previous versions wide tibbles were printed nicely until versions later than 1.3.0. This is what I would like the output to be printed like:

tibble_ok

...but this is what it looks like using the latest version of tibble:

tibble_broken

I tinkered around with the old sources but to no avail. I would like to incorporate this in a package so the solution should pass R CMD check. When I just copied a load of functions from tibble v1.3.0 I managed to restore the old behavior but could not pass the check.

There's an open issue on Github related to this problem but it's apparently 'not high priority'. Is there a way to print tibbles properly with the new version?

Upvotes: 6

Views: 1024

Answers (2)

Bruno
Bruno

Reputation: 115

This seems to have change, now one can just use:

options(tibble.width = Inf)

Upvotes: 0

F. Privé
F. Privé

Reputation: 11738

Try out this function:

print_width_inf <- function(df, n = 6) {
  df %>%
    head(n = n) %>%
    as.data.frame() %>%
    tibble:::shrink_mat(width = Inf, rows = NA, n = n, star = FALSE) %>%
    `[[`("table") %>%
    print()
}

Upvotes: 5

Related Questions