You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
print should abbreviate columns larger than options(width)? #7718
my real use case is parsing text data. sometimes I have a character column with some elements much wider than 80 chars. In that case it would be nice if data table could truncate the character column to that many chars (or slightly smaller to fit).
maybe we could change the default, would options(datatable.prettyprint.char=getOption("width")-5) be possible?
I’m planning to work on this issue, i have a below proposed fix for the issue ,if it sounds good then i will be ready to proceed with the pr .
The planned changes are:
Dynamically setting the default truncation limit based on getOption("width") - 5L when datatable.prettyprint.char is NULL, so narrow consoles avoid line overflow.
Applying char.trunc to list-column character representations to ensure long list outputs are also width-limited.
is this in a right direction or there are any suggestions
Activity
tdhock commentedon Apr 21, 2026
to be fair, data.frame does no better:
tibble also goes over the 10 char width
tdhock commentedon Apr 21, 2026
my real use case is parsing text data. sometimes I have a character column with some elements much wider than 80 chars. In that case it would be nice if data table could truncate the character column to that many chars (or slightly smaller to fit).
maybe we could change the default, would
options(datatable.prettyprint.char=getOption("width")-5)be possible?venom1204 commentedon May 24, 2026
hi @joshhwuu
I’m planning to work on this issue, i have a below proposed fix for the issue ,if it sounds good then i will be ready to proceed with the pr .
The planned changes are:
getOption("width") - 5Lwhendatatable.prettyprint.charis NULL, so narrow consoles avoid line overflow.char.truncto list-column character representations to ensure long list outputs are also width-limited.is this in a right direction or there are any suggestions
tdhock commentedon May 25, 2026
great thx