r - Code equivalent to 'broom' icon in viewer pane of RStudio?
问题描述
To clear the viewer pane in RStudio, we can click on the 'broom' icon.
Is there a way to do this using R code?
Update: here's an example of how to render something random in the viewer pane (my question is how can we clear the viewer pane using code?)
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)
解决方案
For anyone wondering, this works:
clear_viewer_pane <- function() {
dir <- tempfile()
dir.create(dir)
TextFile <- file.path(dir, "blank.html")
writeLines("", con = TextFile)
rstudioapi::viewer(TextFile)
}
clear_viewer_pane()
推荐阅读
- excel - 如何在我的代码中声明科学数据类型
- wpf - 单击滚动条拇指的上方或下方不会滚动
- flutter - 如何将 Uint8List 转换为 Float32List 到 List
在颤振? - flutter - 如何计算颤动中gps高度的海拔高度
- bash - 从 rundeck(linux) 运行 powershell 显示不同的结果
- reactjs - 在 React 应用中使用 Azure 身份验证登录
- php - PHP按类别显示产品
- php - 如何在请求 SQL 结果后对其进行排序?
- flutter - flutter 是如何让 PopupRoute 不覆盖 appbar 的?
- django - 未找到“cart_detail”的反向。“cart_detail”不是有效的视图函数或模式名称