Skip to contents

Opens a file in the viewer of RStudio, Positron or VS Code when it is an HTML page, and otherwise in the web browser or the program the system opens it with. It opens files only in an interactive session. In a script, a knitr or Quarto render, or under R CMD check it opens nothing and prints 1 line with the file's path, so a file written to the temporary folder is never left unseen. The examples that write a file end with it.

Usage

sframe_show(path, quiet = FALSE, option = NULL)

Arguments

path

Character. The file to show.

quiet

Logical. When TRUE, nothing is printed when the file is not opened.

option

Character or NULL. The name of an option that, set to FALSE, keeps the file closed, for a function with its own switch.

Value

TRUE when the file was opened, FALSE otherwise, invisibly.

Examples

path <- file.path(tempdir(), "hello.html")
writeLines("<h1>Hello</h1>", path)
sframe_show(path)