如何格式化HTML表不需要在渲染的rmarkDown中滚动栏?
我有我保存了gtsave
和save_kable
的表。您如何格式化您保存和调用的HTML表的尺寸?我想在编织降价(HTML输出)中查看桌子时不必使用滚动条。
现在,桌子呈现rmarkDown后,桌子很小,您必须使用滚动条向下滚动,然后在页面上看不到整个桌子。
我非常感谢任何帮助使桌子看起来可读的帮助。
我的rmarkDown看起来像这样:
library(tidyverse)
library(gt)
library(knitr)
Library(kableExtra)
table_gt_tbl %>% gtsave(“table_gt_tbl”, path = “PATH”)

music %>% select(ID, location, address, music_type) %>% knitr::kable() %>% kable_styling(latex_options = c(“scale_down”, “HOLD_position”) %>% kableExtra::save_kable(“PATH/music.html”)

>
I have tables that I’ve saved with gtsave
and save_kable
. How do you format the sizes of html tables you’ve saved and called? I want to not have to use the scroll bar when looking at the tables in my knitted markdown (html output).
The tables right now, after rendering the rmarkdown, are small and you have to use scroll bar to scroll downwards and to the side, you can’t see the whole table on the page.
I’d very much appreciate any help in making the tables look readable.
My rmarkdown looks like this:
library(tidyverse)
library(gt)
library(knitr)
Library(kableExtra)
table_gt_tbl %>% gtsave(“table_gt_tbl”, path = “PATH”)

music %>% select(ID, location, address, music_type) %>% knitr::kable() %>% kable_styling(latex_options = c(“scale_down”, “HOLD_position”) %>% kableExtra::save_kable(“PATH/music.html”)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的滚动条可能会自动添加,因为输出
html_document
添加了我认为是 bobnoxious 边距。我建议您首先添加以下CSS。这可以进入RMD的任何地方,只需确保它不在块中即可。
如果这还不够,请尝试增加高度和宽度。
如果您用R调用表,则无需设置高度和宽度。如果您像示例中一样使用表,作为保存的.html文件,您可能需要两者都需要。
这是我用来测试的
Your scrollbars are probably automatically added because the output
html_document
adds what I think are obnoxious margins.I would suggest that you start by adding the following CSS. This can go anywhere in your RMD, just make sure it's not in a chunk.
If that isn't enough, try adding height and width.
If you call the tables with R, you won't need to set the height and width. If you use the tables as you did in your example, as a saved .HTML file, you will probably need both.
Here's what I used to test this