我正在使用栅格层。我在一个父文件夹中有10个子文件夹。每个子文件夹包含数百个栅格。我想为每个子文件夹应用一个脚本,并为我的每个子文件夹创建几个堆栈。
#List all my subfolders in my parent folder
list_dirs<- list.dirs(path/parentfolder/, recursive = F)
for (i in list_dir){
# set the working directory to the subfolder i
setwd(i)
# List all the files with a certain pattern in the subfolder i
s<- list.files(path=setwd(i), pattern = "cool", recursive=F)
# I do not see how I can create a stack for each of my subfolders here.
#I should have an index i somewhere in the last line.
ss<- stack(s)
}
作为最终输出,我希望我的10个子文件夹中的每一个都有10个堆栈。我是新来R的,谢谢!
https://stackoverflow.com/questions/50628255
复制相似问题