I would like to reduce the number of digits printed when calling a data.table object in R. I'd rather fit more columns into the console than seeing up to 8 decimal points for each number.
The standard way, options("digits" = 4)
(as suggested in this question), does not seem to work with data tables.
An example:
set.seed(7)
DT <- data.table(x = rnorm(10), y = 1:10)
DT # prints 10 digits for me, including the decimal point
options("digits" = 4)
DT # prints 8 digits (?)
Generally, though, option
works, since
set.seed(7)
rnorm(1)
prints 2.287