Reputation: 49448
I have a data.table
with more than 10k rows that I'd like to fully print out to the console. Despite the error message you get - increasing options(max.print=...)
doesn't help - the table still gets cut off (depending on OS with max.print
set to 15000 it gets cut off at either 1500 or 7500 for me).
I considered using write.table
instead, but the issue there is that I lose the column alignment that print
normally provides:
dt = data.table(a = c("sdflk", "sdflksdfsdfsdf"), b = c(1,2))
write.table(dt, sep = "\t", quote = F)
#a b
#1 sdflk 1
#2 sdflksdfsdfsdf 2
Is there a way around this limitation?
Here's a large data.table
if you'd like to play around:
dtl = data.table(a = sample(c("sdflk", "sdflksdfsdfsdf"), 15000, T), b = 1:15000)
options(max.print = 15000)
print(as.data.frame(dtl))
print(dtl, nrow = 15000)
Upvotes: 4
Views: 1920
Reputation: 66819
The documentation for max.print
(at ?options
) says it's the number of entries, not rows, so
options(max.print = (nrow(dtl)+1)*ncol(dtl))
seems to work for the example in the OP.
Upvotes: 5