Jonathan
Jonathan

Reputation: 2024

How do I increase the number of columns displayed in Jupyter with R?

I am using a Jupyter notebook with an R kernel. When I print rectangular data, e.g., a matrix, it only shows me the first 10 and last 10 columns:

enter image description here

The same thing happens for data.frames, or any other object that is printed in an HTML table.

How do I change this setting?

Upvotes: 13

Views: 9012

Answers (2)

MarBlo
MarBlo

Reputation: 4534

Jupiter truncates the output. But if you do

print(matrix(1:30, ncol=30))

or

df <- as.data.frame(matrix(1:30, ncol=30))
print(df)

you should get the full matrix or df output.

Upvotes: -3

Jonathan
Jonathan

Reputation: 2024

Figured it out. You can set these in options():

options(repr.matrix.max.cols=50, repr.matrix.max.rows=100)

They default to cols=20 and rows=60.

Upvotes: 25

Related Questions