Open file created by R in an external program Open file created by R in an external program shell shell

Open file created by R in an external program


Are you looking for something like this? It works nicely, at least on my Windows box.

## An example temp fileff <- paste0(tempfile(), ".txt")write.table(head(mtcars), file=ff)## Open the file with the program associated with its file extensionsystem2("open", ff)


How about?

browseURL('view.xlsx')


For an solution that naturally extends your attempts, you could use shell.exec.

Documentation

Opens the specified file using the application specified in the Windows file associations.

ff <- paste0(tempfile(), ".txt")write.table(head(mtcars), file=ff)shell.exec(ff)

Created on 2020-03-11 by the reprex package (v0.3.0.9001)