gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:16:51 30 4
gpt4 key购买 nike

要清除 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com