将 RStudio 的 View() 输出另存为 html [英] Save View() output of RStudio as html

查看:61
本文介绍了将 RStudio 的 View() 输出另存为 html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将我在 RStudio 中使用 View() 命令时看到的页面保存为 html 文件?

Is it possible to save the page which I see when use View() command in RStudio on some data as an html file?

推荐答案

也许你的数据看起来像 mtcars 的数据

Maybe your data looks like the mtcars data

data(mtcars)
View(mtcars)

library(xtable)

sink 命令将输出发送到文件

sink command sends output to a file

sink('somehtmlfile.html')
print(xtable(mtcars),type='html')

然后用

sink()

现在在浏览器中打开 somehtmlfile.html

now open the somehtmlfile.html in a browser

这篇关于将 RStudio 的 View() 输出另存为 html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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