I have set the RStudio Viewer pane to open my default Web Browser instead of the View Pane by setting the following option:
options(viewer=NULL)
How do I reset back to original setting without starting a new rsession?
I want again default to using the Viewer Pane.
If you have already set the viewer to NULL without preserving your settings, then you will need to copy the viewer setting from a new rsession, but no need to close your current session.
1.The options(viewer=XXXXX) setting is, in fact, a function, so open a new ression.
2.Then retrieve the viewer function setting and copy the function by doing the following at RStudio console prompt:
op <- options()
op$viewer
function (url, height = NULL)
{
if (!is.character(url) || (length(url) != 1))
stop("url must be a single element character vector.",
call. = FALSE)
if (identical(height, "maximize"))
height <- -1
if (!is.null(height) && (!is.numeric(height) || (length(height) !=
1)))
stop("height must be a single element numeric vector or 'maximize'.",
call. = FALSE)
invisible(.Call("rs_viewer", url, height))
}
In order to restore your viewer to default now go to the old rsession (the session you want to restore) and at the console prompt restore the viewer option:
>options(viewer=function (url, height = NULL)
{
if (!is.character(url) || (length(url) != 1))
stop("url must be a single element character vector.",
call. = FALSE)
if (identical(height, "maximize"))
height <- -1
if (!is.null(height) && (!is.numeric(height) || (length(height) !=
1)))
stop("height must be a single element numeric vector or 'maximize'.",
call. = FALSE)
invisible(.Call("rs_viewer", url, height))
})
These steps will now fully restore the RStudio Viewer Pane.