Bug 15999 - Logical values with names of 1000 chars or more not printing correctly
Summary: Logical values with names of 1000 chars or more not printing correctly
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R-devel (trunk)
Hardware: All All
: P5 minor
Assignee: R-core
Depends on:
Reported: 2014-09-28 12:27 UTC by Richard Cotton
Modified: 2014-11-05 19:10 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Richard Cotton 2014-09-28 12:27:48 UTC
Logical vectors with names longer than 999 characters do not display correctly.  That is,  "TRUE" or "FALSE" is abbreviated.

To reproduce:

make_random_string <- function(n)
  paste0(sample(letters, n, replace = TRUE), collapse = "")

setNames(TRUE, make_random_string(999))   # OK
setNames(TRUE, make_random_string(1000))  # value printed as TRU
setNames(TRUE, make_random_string(1002))  # value printed as T
setNames(TRUE, make_random_string(1003))  # value not printed

setNames(FALSE, make_random_string(999))   # OK
setNames(FALSE, make_random_string(1000))  # value printed as FALS
setNames(FALSE, make_random_string(1003))  # value printed as F
setNames(FALSE, make_random_string(1004))  # value not printed

# still applies in the vectorised case
setNames(runif(10) > 0.5, replicate(10, make_random_string(1000)))

The values are correct (check with unname); it is merely the printing that is the problem.
Comment 1 Duncan Murdoch 2014-11-05 19:10:40 UTC
This also affects some things other than logicals:  NA of any type, NaN, Inf, etc.  I'll fix in R-devel and R-patched.