Re: [R] missForest: Looping through files in a folder

2016-01-01 Thread Morteza Firouzi via R-help
Hi Jim,Thank you very much for the time.You saved me 3 days! Best regards, Morteza On Saturday, January 2, 2016 5:33 AM, Jim Lemon wrote: Hi Morteza,What you may want is this: my.files<-list.files(pattern=".csv")newfiles<-gsub(".","_F.",my.files,fixed=TRUE)for(i in 1:length(my.files))

Re: [R] missForest: Looping through files in a folder

2016-01-01 Thread Jim Lemon
Hi Morteza, What you may want is this: my.files<-list.files(pattern=".csv") newfiles<-gsub(".","_F.",my.files,fixed=TRUE) for(i in 1:length(my.files)) { mydat<-read.csv(my.files[i]) mydatimp<-missForest(mydat,verbose=TRUE,maxiter=5) write.csv(mydatimp$ximp,newfiles[i]) } Jim On Sat, Jan 2, 2

[R] missForest: Looping through files in a folder

2016-01-01 Thread Morteza Firouzi via R-help
Dear members, Could you please help me on this issue. I've already searched and I watched some videos, but it was not useful.I need help to loop through the files in a folder (200+ csv files). I am using missForest() to impute missing values. If I run the code for each single file, I have to do