如何检查文件路径中是否存在变量R中是否存在文件

时间:2020-10-12 19:06:29

标签: r

如果文件路径中有变量,我将如何查找文件路径是否存在?

month = format(Sys.Date()-32, format = "%Y-%m")
dir = file.path("Some:\\Path\")
ec = file.path(month)
tory = file.path("\continued.csv")

if (file.exists(dir,ec,tory)){
    print('TRUE')
} else {
    print('FALSE')
}

我正在尝试查看是否存在“ Some:\ Path \ 2020-09 \ continued.csv”。如果我下个月要运行此程序,它将搜索“ Some:\ Path \ 2020-10 \ continued.csv”

0 个答案:

没有答案