crazybilly
crazybilly

Reputation: 3092

Prevent tibble from abbreviating column names

When using tibble 1.4.1, a tibble printed on the console will often abbreviate column names.

For example, set your console width to about 400 px wide and print the dplyr::starwars data frame. Column names are shown as:

name     height  mass hair_c~ skin_c~ eye_c~ birth_~ gender home~ spec~ films vehi~ star~

I tried setting options(tibble.width = 6), thinking that would only print 6 columns, but it still prints all columns.

Is there a way to prevent tibble from abbreviating column names and return to the previous behavior where it only printed the columns it had room for?

Upvotes: 5

Views: 840

Answers (1)

crazybilly
crazybilly

Reputation: 3092

Looks like there's a couple problems going on here. In version 1.4.1, tibble moved to using the pillar package for print formatting--the defaults options for pillar weren't optimal. Too, there was a bug that kept options(tibble.width = 6) from working.

Upgrading tibble to 1.4.2, as MrFlick recommends, changes the pillar defaults to much more reasonable options and solves the tibble.width bug as well.

Changing the exposed options for pillar might also help tibble print formatting on your console, depending on what font you're using.

Upvotes: 2

Related Questions