On a side note: On Thu, May 20, 2010 at 9:43 AM, Ivan Calandra <ivan.calan...@uni-hamburg.de> wrote: > Thanks to all of you for your answers! > > ... > > Tao, I don't understand why you have backslashes before "file" and after > .rda. I guess it's something about regular expression, but I'm still > very new to it. > eval(parse(text=paste("save(file", i, ", file=\"file", i, ".rda\")", > sep=""))) > Very simple: You need to give a command as a string. In the save command, you have to put quotation marks around the filename. Now within the paste function, a simple quotation mark would make R believe the string to paste ends there, and you don't want that. So you escape the " by typing \", then R knows you want to add the symbol " to the string instead of end it. :
> paste("save(file", i, ", file=\"file", i, ".rda\")",sep="") [1] "save(file2, file=\"file2.rda\")" > parse(text=paste("save(file", i, ", file=\"file", i, ".rda\")",sep="")) expression(save(file2, file="file2.rda")) attr(,"srcfile") <text> > paste("save(file", i, ", file="file", i, ".rda")",sep="") Error: unexpected symbol in "paste("save(file", i, ", file="file" Hope it's a bit more clear now. Cheers Joris -- Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ R-help@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.