3

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

inscaven
  • 2,514
  • 19
  • 29
  • Have you noticed that when you right-click anywhere in RStudio, there is an "Inspect" option? It might be a little too cumbersome to do that every time, but I'd think that it's possible to copy-paste from out of the web inspector. – maj Jun 02 '15 at 15:37
  • what do you mean as an html file? you want to save it as a table? https://github.com/gforge/htmlTable – rawr Jun 02 '15 at 15:38
  • 2
    If all you need is a package for table export to html, you might like the `xtable` package as well. – maj Jun 02 '15 at 15:45
  • What version of RStudio are you using? In 0.98, you're literally looking at a .html file (you can use the aforementioned Inspect option to find the Iframe that points to it, and copy from there); in 0.99, the data viewer is a Web app that needs a connection to RStudio itself to stream new data, so there's no way to save it offline. – Jonathan Jun 02 '15 at 18:07

1 Answers1

5

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

Seth
  • 4,745
  • 23
  • 27