将其查看器选项设置为 NULL 后如何恢复 RStudio 查看器窗格? [英] How to restore RStudio Viewer Pane after having setting its viewer option to NULL?

查看:57
本文介绍了将其查看器选项设置为 NULL 后如何恢复 RStudio 查看器窗格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已通过设置以下选项将 RStudio 查看器窗格设置为打开我的默认 Web 浏览器而不是查看窗格:

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.

推荐答案

如果您已经在没有保留设置的情况下将查看器设置为 NULL,那么您将需要从新的 rsession 复制查看器设置,但无需关闭您当前的会话.

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.options(viewer=XXXXX)设置其实就是一个函数,所以开一个新的ression.

1.The options(viewer=XXXXX) setting is, in fact, a function, so open a new ression.

2.然后通过在 RStudio 控制台提示下执行以下操作来检索查看器功能设置并复制该功能:

2.Then retrieve the viewer function setting and copy the function by doing the following at RStudio console prompt:

op <- options()

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))
}

为了将您的查看器恢复为默认值,现在转到旧的 rsession(您要恢复的会话)并在控制台提示下恢复查看器选项:

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))
})

这些步骤现在将完全恢复 RStudio 查看器窗格.

These steps will now fully restore the RStudio Viewer Pane.

这篇关于将其查看器选项设置为 NULL 后如何恢复 RStudio 查看器窗格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆