Is this an off by one bug?
> options(datatable.print.trunc.cols=TRUE)
> options(width=10)
> (dt7=data.table(x="1234567"))
1 variable not shown: [x]
> (dt6=data.table(x="123456"))
x
1: 123456
Above we see dt6 is 9 characters wide (6 characters of data and 3 of row number, colon, space), and dt7 gets truncated, even though I expected that it should print (we have enough space for it with width=10).
Below we see that dt7 prints if we set width=11, which enables printing of this 10 character wide table.
> options(width=11)
> dt7
x
1: 1234567
Does the current code count the trailing newline as one of the characters toward the width limit? (I expect it should not)
For reference, ?print.data.table says
trunc.cols: If ‘TRUE’, only the columns that can be printed in the
console without wrapping the columns to new lines will be
printed (similar to ‘tibbles’).
?options says
‘width’:
controls the maximum number of columns on a line used in
Is this an off by one bug?
Above we see dt6 is 9 characters wide (6 characters of data and 3 of row number, colon, space), and dt7 gets truncated, even though I expected that it should print (we have enough space for it with width=10).
Below we see that dt7 prints if we set width=11, which enables printing of this 10 character wide table.
Does the current code count the trailing newline as one of the characters toward the width limit? (I expect it should not)
For reference, ?print.data.table says
?options says