如何使用 R 增加 Jupyter 中显示的列数?

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

我正在使用带有 R 内核的 Jupyter 笔记本。当我打印矩形数据(例如矩阵)时,它只显示前 10 列和后 10 列:

data.frames 或任何其他打印在 HTML table 中的对象也会发生同样的事情。

如何更改此设置?

想通了。您可以在 options():

中设置这些
options(repr.matrix.max.cols=50, repr.matrix.max.rows=100)

它们默认为 cols=20 和 rows=60。

Jupiter 截断输出。但如果你这样做

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

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

你应该得到完整的矩阵或 df 输出。