Joh*_*ohn 5 connection r temp shiny
我创建了一个R Shiny应用程序,该程序每天使用批处理文件自动运行。启动应用程序时,一切正常,但第二天崩溃,我收到以下消息:
Warning in file(open = "w+") :
cannot open file
'C:\Users\bertin\AppData\Local\Temp\RtmpKiBPOU\Rf3f835d1a66' : No such file or directory
Warning: Error in file: cannot open the connection
[No stack trace available]
Run Code Online (Sandbox Code Playgroud)
实际上,此问题与tempdir()
由执行闪亮应用程序的R会话创建的文件夹有关。一定时间后,此文件夹将自动删除。每次刷新时都必须删除所有Temp文件吗?还是相反,是否需要防止R删除Temp文件夹上的所有闪亮的临时文件?谢谢!
编辑 -这是有意产生错误的方法:
tempdir()
dir.exists(tempdir())
library(shiny)
# Windows shell required
shinyApp(
ui = fluidPage("Please reload to see me fail."),
server = function(input, output) {
shell(paste("rmdir", dQuote(
normalizePath(tempdir(), winslash = "/", mustWork = FALSE), q = FALSE
), "/s /q"))
}
)
Run Code Online (Sandbox Code Playgroud)
删除临时目录后,会话数据也会丢失。但如果我正确理解你的问题,这与你的闪亮应用程序无关。\n因此,如果你不需要昨天的任何会话数据,你可以调用 \xe2\x80\x98.rs.restartR()\ xe2\x80\x98 重新启动 R 会话,从而设置新的临时目录。您可能会收到一条错误,指出无法保存最后一个会话(因为该目录不再存在\xe2\x80\x98)。\n此后您应该能够再次启动您的 Shiny 应用程序。
\n 归档时间: |
|
查看次数: |
607 次 |
最近记录: |