如何将用(DT)创建的表,数据表保存到高质量图像中? [英] How to save a table I created with (DT), datatable into a high quality image?

查看:41
本文介绍了如何将用(DT)创建的表,数据表保存到高质量图像中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个可以在查看器"中查看的数据表.如果我使用导出来复制图像或将其另存为.png,那么它的质量往往会很低吗?

I created a datatable that can be viewed in my "Viewer". If I use export to copy the image or save is as a .png it tends to be really low quality?

我最好的选择是截取图像并将其粘贴到工作文档中,以便在其中键入报告,但是我知道必须有更好的方法.

My best option has been screenshotting the image and pasting it to my work document where I type out my report, but I know there has to be a better way.

关于我该怎么办的任何建议?

Any advice on what I can do?

推荐答案

您可以使用 saveWidget 函数将数据表保存为html文件,然后使用 webshot 打包以拍摄快照.

You can use the saveWidget function to save the datatable in a html file, then use the webshot package to take a snapshot.

library(DT)
library(webshot)
dtable <- datatable(iris[1:8,])
html <- "dtable.html"
saveWidget(dtable, html)
webshot(html, "dtableSnapshot.png") # you can also export to pdf

这篇关于如何将用(DT)创建的表,数据表保存到高质量图像中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆