r - 代码相当于 RStudio 查看器 Pane 中的 'broom' 图标?

要清除 RStudio 中的查看器 Pane ,我们可以单击“扫帚”图标。

有没有办法使用 R 代码来做到这一点?

更新:这是一个如何在查看器 Pane 中随机呈现某些内容的示例(我的问题是我们如何使用代码清除查看器 Pane ?)


sometext <- "<p>This text will render in the viewer pane</p>"

dir <- tempfile()
dir.create(dir)
TextFile <- file.path(dir, "TextFile.html")

writeLines(sometext, con = TextFile)
rstudioapi::viewer(TextFile) 

最佳答案

对于任何想知道的人,这有效:

clear_viewer_pane <- function() {
  dir <- tempfile()
  dir.create(dir)
  TextFile <- file.path(dir, "blank.html")
  writeLines("", con = TextFile)
  rstudioapi::viewer(TextFile) 
}

clear_viewer_pane()

关于r - 代码相当于 RStudio 查看器 Pane 中的 'broom' 图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59022663/

相关文章:

hibernate - Spring JPA 审计因多个数据源而失败

android - 无法再在 Android Studio 中运行单独的插桩测试

linkedin - 检索 Linkedin Video Post 的缩略图 (ugcPost AP

reactjs - React 中的 forwardingRef 与回调 refs 有什么区别?

angular - ViewChild 与 Directive 获取 ViewContainerRe

flutter - 将 mapEventToState 与传入流一起使用的最佳实践?

python - Jupyter Lab 交互图像展示 : issue with widgets a

python - 使用 Python Requests 在 postman 中做 post 请求

angular - 如果我重新分配一个存储 rxjs 订阅的变量,那会取消订阅吗?

visual-studio-code - VSCode 个人快捷方式在笔记本编辑器中不起作用