Skip to Content

How to open a local html file from R in an operating system independent way?

How to open a local html file from R in an operating system independent way?

For demonstration purposes, assume that the file is called test.html and is in the working directory.

initial thoughts

  • system('gnome-open test.html')
    • This works on Ubuntu
  • browseURL(paste('file://', getwd(),'test.html', sep='/'))
    • This works on Ubuntu, but it feels like a bit of a hack and I'm not certain whether it would work on Windows.