Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7802 +/- ##
=======================================
Coverage 98.85% 98.85%
=======================================
Files 87 87
Lines 17140 17142 +2
=======================================
+ Hits 16944 16946 +2
Misses 196 196 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Generated via commit 3699adc Download link for the artifact containing the test results: ↓ atime-results.zip
|
|
|
||
| #7797 long column names go past width | ||
| test(2377.1, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="abcdefghijklmn...", options=list(width=20)) | ||
| test(2377.2, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="1 variable not shown: \\[abcdefghijklmn... <num>\\]", options=list(width=20, datatable.print.trunc.cols=TRUE, datatable.print.class=TRUE)) |
There was a problem hiding this comment.
please add a test with more than one column.
- 3 cols: two too long, one not
- 4 cols: one too long, next not, next too long, next not
- etc
There was a problem hiding this comment.
i added two tests , are they satisfying what you were excpecting.
thanks.
There was a problem hiding this comment.
this is better but the test output has regex so difficult for me to see what it actually prints as, can you please add the output of these tests in a PR comment?
| test(2377.1, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="abcdefghijklmn...", options=list(width=20)) | ||
| test(2377.2, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="1 variable not shown: \\[abcdefghijklmn... <num>\\]", options=list(width=20, datatable.print.trunc.cols=TRUE, datatable.print.class=TRUE)) | ||
| test(2377.3, print(data.table(abcdefghijklmnopqrst=1)), output="abcdefghijklmnopqrst", options=list(width=30)) | ||
| test(2377.4, print(data.table(abcdefghijklmnopqrstuvwxyz=1, zyxwvutsrqponmlkjihgfedcba=2)), output="zyxwvutsrqponm...", options=list(width=40, datatable.print.trunc.cols=TRUE)) |
There was a problem hiding this comment.
it looks like we're only asserting the footer output here? can we make the assertions stronger?
| e_trunc = getOption("datatable.prettyprint.char") %||% (getOption("width") - 5L) | ||
| t_names = char.trunc(head(names(x), 6L), trunc.char = e_trunc) |
There was a problem hiding this comment.
can these 5L and 6L get put in variables with informative names so we can understand where they come from? or please at least add a comment to explain?
There was a problem hiding this comment.
just wanted to ask on thing that should `datatable.prettyprint.char = Inf`` also disable truncation of column names, or should column names always respect the available print width?
There was a problem hiding this comment.
this is what i got for the first twotests
> options(width=20)
print(data.table(abcdefghijklmnopqrstuvwxyz=1))
abcdefghijklmn...
<num>
1: 1
> options(width=20,
datatable.print.trunc.cols=TRUE,
datatable.print.class=TRUE)
print(data.table(abcdefghijklmnopqrstuvwxyz=1))
1 variable not shown: [abcdefghijklmn... <num>]
| rn_w = if (isTRUE(row.names)) nchar(as.character(max(rn))) + 2L else 0L | ||
| width_limit = max(0L, getOption("width") - rn_w - 3L) |
There was a problem hiding this comment.
same here please explain 0L 3L 2L?
|
|
||
| #7797 long column names go past width | ||
| test(2377.1, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="abcdefghijklmn...", options=list(width=20)) | ||
| test(2377.2, print(data.table(abcdefghijklmnopqrstuvwxyz=1)), output="1 variable not shown: \\[abcdefghijklmn... <num>\\]", options=list(width=20, datatable.print.trunc.cols=TRUE, datatable.print.class=TRUE)) |
There was a problem hiding this comment.
this is better but the test output has regex so difficult for me to see what it actually prints as, can you please add the output of these tests in a PR comment?

closes #7797
apply width based truncation to long column names when printing
data.tables, ensuring that table headers and hidden-column footers respect the available console width.