You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
print.data.table row id in scientific notation #1167
The row names while printing, in data.table the row id sequence, is printed in scientific notation. I wonder if it was like that all the time? or maybe it is something which came with 3.2.0?
It is some way confusing as does not distinct the row numbers.
library(data.table)
set.seed(1)
DT<- data.table(a=1:5, b=letters[1:3], d= rnorm(5*3*1e6))
DT# a b d#1.0e+00: 1 a -0.6264538#2.0e+00: 2 b 0.1836433#3.0e+00: 3 c -0.8356286#4.0e+00: 4 a 1.5952808#5.0e+00: 5 b 0.3295078# --- #1.5e+07: 1 b 0.8778030#1.5e+07: 2 c -1.8297175#1.5e+07: 3 a -2.0020279#1.5e+07: 4 b -0.5252506#1.5e+07: 5 c -1.5342523
R version 3.2.0 (2015-04-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_DK.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.9.5
loaded via a namespace (and not attached):
[1] tools_3.2.0 knitr_1.10.5 chron_2.3-45
Yeah, the printing thing is a bug visible in print.data.table. The last line of
if (isTRUE(row.names))
rownames(toprint) = paste(format(rn, right = TRUE), ":",
sep = "")
else rownames(toprint) = rep.int("", nrow(x))
should refer to nrow(toprint) instead.
I don't know about the rownumbers-over-1e7 thing. That's the highest I've ever needed to go in practice. I guess the culprit is the format line, but can't figure out how. It shows up the same (with scientific notation) for R 3.0.1.
Activity
franknarf1 commentedon Jun 1, 2015
Yeah, the printing thing is a bug visible in
print.data.table. The last line ofshould refer to
nrow(toprint)instead.I don't know about the rownumbers-over-1e7 thing. That's the highest I've ever needed to go in practice. I guess the culprit is the
formatline, but can't figure out how. It shows up the same (with scientific notation) for R 3.0.1.print.data.table in non-scientific numbers, closes Rdatatable#1167