[R] Eval to write many files

From: Alaios <alaios_at_yahoo.com>
Date: Wed, 27 Apr 2011 04:59:02 -0700 (PDT)

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]])

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 27 Apr 2011 - 12:02:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Apr 2011 - 12:50:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive