FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Ivan's great suggestion to just use NA · Rdatatable/data.table@a80cd2f · GitHub

Repository navigation

Commit a80cd2f

Browse files
Ivan's great suggestion to just use NA
1 parent d24370b commit a80cd2f

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎NEWS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272

7373
16. `copy()` is now more consistent about reallocating nested `data.table`s, [#7456](https://github.com/Rdatatable/data.table/issues/7456). The resulting list is now only overwritten when necessary, list columns inside data.tables are searched recursively, and their attributes are walked in search of data.tables to reallocate as well. Thanks to @be-marc for the report, @david-cortes for additional information, and @aitap for the fix.
7474

75+
17. `print()` works with multi-byte characters on R before 4.2.0, [#7848](https://github.com/Rdatatable/data.table/pull/7848). Thanks @MichaelChirico for the fix and @aitap for the improvement.
76+
7577
### Notes
7678

7779
1. {data.table} now depends on R 3.5.0 (2018).

‎R/print.data.table.R‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,8 @@ char.trunc = function(x, trunc.char = getOption("datatable.prettyprint.char")) {
256256
if (is.null(trunc.char)) return(x)
257257
trunc.char = max(0L, suppressWarnings(as.integer(trunc.char[1L])), na.rm=TRUE)
258258
if (!is.character(x) || trunc.char <= 0L) return(x)
259-
nchar_width = tryCatch(nchar(x, 'width', allowNA=TRUE), error=identity)
260-
if (inherits(nchar_width, "error")) { # for R<4.2 e.g. 2366.6 print of fread table gives 'invalid multibyte string'
261-
x = encodeString(x)
262-
nchar_width = nchar(x, 'width', allowNA=TRUE)
263-
}
259+
# TODO(R>=4.2.0): we only need the tryCatch() for old bug in allowNA=TRUE, see #7848
260+
nchar_width = tryCatch(nchar(x, 'width', allowNA=TRUE), error=function(.) NA)
264261
nchar_chars = nchar(x, 'char', allowNA=TRUE)
265262
is_full_width = nchar_width > nchar_chars
266263
is_full_width[is.na(is_full_width)] = FALSE

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL