Skip to content

Commit

Permalink
Mention possible limitations of strtrim approach (#6743)
Browse files Browse the repository at this point in the history
* Mention possible limitations of strtrim approach

* mention in NEWS
  • Loading branch information
MichaelChirico authored Jan 27, 2025
1 parent bfccc23 commit 9fb90d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ rowwiseDT(
+ Using `droplevels(in.place=TRUE)` (warning since v1.16.0) has been upgraded from warning to error. The argument will be removed in the next release.
+ Use of `:=` and `with=FALSE` in `[` has been upgraded from warning (since v1.15.0) to error. Long ago (before 2014), this was needed when, e.g., assigning to a vector of column names defined outside the table, but `with=FALSE` is no longer needed to do so: `DT[, (cols) := ...]` works fine.

11. Better handling of multibyte characters in `print()`, added in 1.16.0, has the side effect of possibly ignoring invisible characters like `\n` or `\t` for the purposes of counting width for `datatable.prettyprint.char`. That's because we switched to using `strtrim()` over `substring()`, the latter of which is explicitly discouraged for the purposes of truncating strings, whereas the former of which has platform-dependent behavior for whether invisible characters count towards string width.
# data.table [v1.16.4](https://github.com/Rdatatable/data.table/milestone/36) 4 December 2024
## BUG FIXES
Expand Down
3 changes: 1 addition & 2 deletions man/print.data.table.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

\code{format_col} and \code{format_list_item} generics provide flexibility for end-users to define custom printing methods for generic classes.

Note also the option \code{datatable.prettyprint.char}; character columns entries exceeding this limit will be truncated, with \code{...} indicating the truncation.
}
Note also the option \code{datatable.prettyprint.char}; character columns entries exceeding this limit will be truncated, with \code{...} indicating the truncation. Note that the truncation is done with \code{\link{strtrim}}; be cognizant of potential limitations when dealing with non-printable characters like newlines or tabs. }
\usage{
\method{print}{data.table}(x,
topn=getOption("datatable.print.topn"), # default: 5
Expand Down

0 comments on commit 9fb90d4

Please sign in to comment.