问题描述
我有这个代码
library(plyr)
library(readxl)
library(XLConnect)
#Set the Path
layout_path <- "/rdrive/my_test/"
output_path <- "/rdrive/my_test/"
filenames <- list.files(path = layout_path,pattern="*xls",ignore.case=TRUE)
filecount <- length(list.files(path = layout_path,ignore.case=TRUE))
err_fs =
for (f in filenames) {
tryCatch(
{
nverr <- read_excel(paste(layout_path,f,sep=''),sheet = 1,col_names = FALSE,range = cell_cols("A:A"))
},error=function(err) {
filenames[names(filenames) != f]
cat("File doesn't appear to open:",conditionMessage(err),"\n")
})
}
尽管其他所有内容似乎都正常,但filenames [names(filenames)!= f]无法从列表“ filenames”中删除错误的文件名。 我什至尝试了数字方法,但完全是..可能是因为它在错误函数中吗?
不胜感激,请提出建议。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)