Possible to print more than 100 rows of a data.table? Possible to print more than 100 rows of a data.table? r r

Possible to print more than 100 rows of a data.table?


The print method of data.table has an argument nrows:

args(data.table:::print.data.table)function (x, nrows = 100L, digits = NULL, ...) 

You can use this to control how many rows get printed:

print(dtIris, nrow=105).....99:          5.1         2.5          3.0         1.1 versicolor100:          5.7         2.8          4.1         1.3 versicolor101:          6.3         3.3          6.0         2.5  virginica102:          5.8         2.7          5.1         1.9  virginica103:          7.1         3.0          5.9         2.1  virginica104:          6.3         2.9          5.6         1.8  virginica105:          6.5         3.0          5.8         2.2  virginica     Sepal.Length Sepal.Width Petal.Length Petal.Width    Species


View() (as in View(iris) or View(dtIris[1:120,])) doesn't truncate data.tables, and can often be nicer than printing/spewing out a data.* to the console.


To print the top 60 and bottom 60 lines (default is top 5 and bottom 5):

print(dtIris, topn = 60)