繁体   English   中英

file.exists 在 R Shiny App 中不工作

[英]file.exists not working in R Shiny App

我是 R Shiny 的新手,我正在尝试查找特定文件是否存在。 我的代码在 R 中正常工作(给出肯定的结果)但是当我尝试在 shiny 中使用相同的代码时,它给出了否定的结果。

代码:

if(isTRUE(file.exists("temp.rds"))){
print("File Present")
}else{
print("File Not Present")
}

R 中的 Output:文件存在

Output in Shiny:文件不存在

我认为,在 Shiny 中有一些我不理解的基本概念。请帮忙。

正如 HubertL 所指出的,shiny 工作目录是 ui 和服务器文件所在的位置。 这应该工作:

if(isTRUE(file.exists("./www/temp.rds"))){
print("File Present")
}else{
print("File Not Present")
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM