Save View() output of RStudio as html

2019-05-15 21:11发布

问题:

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

回答1:

Maybe your data looks like the mtcars data

data(mtcars)
View(mtcars)

library(xtable)

sink command sends output to a file

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

then return things back to normal with

sink()

now open the somehtmlfile.html in a browser



标签: r rstudio