【发布时间】:2019-04-06 11:53:44
【问题描述】:
我想使用“imager”包中提供的 load.image() 函数加载多个图像,但出现“找不到文件”消息的错误。有人可以帮我解决这个问题吗?
我尝试加载列表中的图像,并将此列表作为参数添加到 load.image() 函数中,但它只能读取一个文件,因此无法接受列表。在此之后,我尝试使用 for 循环在列表中进行迭代,并将循环中的索引添加为参数,我遇到了这个问题:“wrap.url 中的错误(文件,load.image.internal):文件没找到”
filenames <- list.files("~/Downloads/project", pattern="*.JPG")
for(idx in filenames) {
load.image(idx)
"I tried here with concatenate the idx with the path string, but with no success"
load.image(paste("~/Downloads/project",idx))
}
【问题讨论】:
-
这可能就像指定要在粘贴函数中使用的分隔符一样简单。 load.image(paste("~/Downloads/project",idx,sep=""))