​

Friday, 9 June 2017

Create Multiple Folders Using R Codes

Create Multiple Folders Using R Codes


Below codes show how to create multiple folders without leaving R environment. The code chunk is useful when, for example, doing graphical diagnostics for some statistical models and numerous (e.g., several hundreds or thousands) diagnostic plots will be produced.  Multiple plots can be woven into a html file, and visually checked afterward.  


foldername <- read.table(nameList.txt, header=FALSE, sep=".")[,1]
 
for(i in 1:length(foldername)){
tmp <- foldername[i]
test <- paste("mkdir ", tmp, sep="")
system(test)
}
download
alternative link download

Like the Post? Do share with your Friends.
​