r - 如何在 markddown 中调整 R 输出表的大小?
问题描述
我一直在寻找时间在降价时调整表格大小,以免损坏。我想过减少源或强制它不中断,但我该怎么做呢?我只找到了使用 kable 或 kableextra 的解决方案,但是我想要默认样式。我将数据留在了网址中。
解决方案
我们可以改变width
in options
。检查电流width
并进行这些更改
> head(cbind(iris, iris, iris))
Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length
1 5.1 3.5 1.4 0.2 setosa 5.1 3.5 1.4 0.2 setosa 5.1 3.5 1.4
2 4.9 3.0 1.4 0.2 setosa 4.9 3.0 1.4 0.2 setosa 4.9 3.0 1.4
3 4.7 3.2 1.3 0.2 setosa 4.7 3.2 1.3 0.2 setosa 4.7 3.2 1.3
4 4.6 3.1 1.5 0.2 setosa 4.6 3.1 1.5 0.2 setosa 4.6 3.1 1.5
5 5.0 3.6 1.4 0.2 setosa 5.0 3.6 1.4 0.2 setosa 5.0 3.6 1.4
6 5.4 3.9 1.7 0.4 setosa 5.4 3.9 1.7 0.4 setosa 5.4 3.9 1.7
Petal.Width Species
1 0.2 setosa
2 0.2 setosa
3 0.2 setosa
4 0.2 setosa
5 0.2 setosa
6 0.4 setosa
> op <- options()
> options()$width # check the current width
[1] 167
> options(width = 300) # change the width and now do the print again
> head(cbind(iris, iris, iris))
Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa 5.1 3.5 1.4 0.2 setosa 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa 4.9 3.0 1.4 0.2 setosa 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa 4.7 3.2 1.3 0.2 setosa 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa 4.6 3.1 1.5 0.2 setosa 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa 5.0 3.6 1.4 0.2 setosa 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa 5.4 3.9 1.7 0.4 setosa 5.4 3.9 1.7 0.4 setosa
options
完成后,再次重置
> options(op)
> options()$width
[1] 167
推荐阅读
- html - 如何在 HTML 框架中显示来自 WCF 服务的 MemoryStream
- laravel - 使用上传 laravel-Excel 的用户详细信息导入 csv 数据
- javascript - 如何使用 ajax 发布复杂的 url 请求
- python - 如果我打开两个 GUI 运行 python 项目,每个的速度会比单独运行它们慢吗?
- reactjs - Mysql 5.7 每次都拉
- java - 参考行为
- python - Pandas:通过提供标题名称来阅读列
- sql-server - 多个 INNER JOIN SELECT 查询不返回数据
- jquery - 如果孩子为空,则隐藏父跨度
- c - 如何在 ARM Assembly 中为后缀函数添加中缀