我正在尝试在父文件夹中创建多个子文件夹。我创建了这段代码,但它没有创建我的子文件夹。我想在文件夹" xxxx"。
中创建子文件夹setwd<- "path/xxxx"
subfolder_names<- (a, b, c, d)
for (j in1: length(subfolder_names)){
folder<-dir.create("path/xxxx/", paste(j))}
提前感谢您的建议。
答案 0 :(得分:0)
一些注意事项:
subfolder_names <- c("a","b","c","d")
for (j in 1:length(subfolder_names)){
folder<-dir.create(paste0("path/xxxx/",subfolder_names[j]))
}
&#13;
答案 1 :(得分:0)
基于上面的评论,我有这个,它可以工作。
subfolder_names <- c("a","b","c","d")
for (j in seq_along(subfolder_names)){
folder<-dir.create(paste0("C:/Users/OGUNDEPO EZEKIEL .A/Desktop/",subfolder_names[j]))}
答案 2 :(得分:0)
这个:
base_path <- "path/xxxx"
subfolder_names <- ("a", "b", "c", "d")
for (name in subfolder_names) {
path <- paste0(base_path, "/", name)
dir.create(path)
}