see:
https://support.rstudio.com/hc/en-us/articles/202133558-Extending-RStudio-with-the-Viewer-Pane
to know if currently in viewer pane, use this thing:
http://localhost:8100?viewer_pane=1
best:
viewer <- getOption("viewer")
if (!is.null(viewer))
viewer("http://localhost:8100")
else
utils::browseURL("http://localhost:8100")
rstudio::viewer("http://localhost:8100")
or
tempDir <- tempfile()
dir.create(tempDir)
htmlFile <- file.path(tempDir, "index.html")
# (code to write some content to the file)
rstudio::viewer(htmlFile)
see:
https://support.rstudio.com/hc/en-us/articles/202133558-Extending-RStudio-with-the-Viewer-Pane
to know if currently in viewer pane, use this thing:
best:
or