也许您的数据看起来像mtcars数据
data(mtcars)
View(mtcars)
library(xtable)
Run Code Online (Sandbox Code Playgroud)
sink命令将输出发送到文件
sink('somehtmlfile.html')
print(xtable(mtcars),type='html')
Run Code Online (Sandbox Code Playgroud)
然后将事情恢复正常
sink()
Run Code Online (Sandbox Code Playgroud)
现在在浏览器中打开somehtmlfile.html