[R] Eval to write many files
Alaios
alaios at yahoo.com
Wed Apr 27 13:59:02 CEST 2011
Dear all
I am looking for a shorter way and more elegant to write the following
for (i in c(1:length(Shadowlist))){
filename<-paste('/home/apa/maps/',model,i,'.mat',sep="")
varname<-paste(model,'_shadow',i,sep="")
eval(parse(text=paste('writeMat(filename,',varname,'=Shadowlist[[i]])',sep="")))
}
actually I do not like eval at the end but I wanted to control the varname inside the writeMat command
writeMat(filename,varname=Shadowlist[[i]])
More information about the R-help
mailing list