Opening external files from R

Go on, have a browse

R
Author

Nick Twort

Published

22 Sep 2023

Sometimes you want to check out a link that you generate in an R script, or perhaps open a table of outputs that you’ve just saved as a csv.

It’s as simple as passing the URL or file path to browseURL, eg:

browseURL("https://til.cardioid.co.nz/posts/open-files-from-r.html")

browseURL("path/to/your/file.csv")

They will open in your default for each filetype - URLs in the browser and csv files (for example) in Excel.

I find this particularly useful as the last step in a script.