As Thomas Lumley has frequently noted, eval(parse...)) should generally be avoided.
You probably want do.call(), as in ## warning: UNTESTED lapply(numbs, function(n)do.call(read.xls,list(file=paste("Book",n,".xls",sep=""),sheet=1, ...))) ## ... contains the other explicitly names arguments Note that this would automatically create your list for you. Cheers, Bert Gunter Genentech Nonclinical Statistics -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erik Iverson Sent: Tuesday, February 26, 2008 9:29 AM To: Michael Anyadike-Danes Cc: r-help@r-project.org Subject: Re: [R] using eval-parse-paste in a loop > ############### stripping off eval, looking for clues > > > > parse(paste('read.xls("Book',nam,'.xls",sheet=1,from=4,colClasses="numer > ic")',sep='')) > > Error in file(file, "r") : unable to open connection > > In addition: Warning message: > > In file(file, "r") : > > cannot open file > 'read.xls("Book1.xls",sheet=1,from=4,colClasses="numeric")', reason > 'Invalid argument' > Your clue is that it looks like parseis unsuccessfully trying to open a file. Look at ?parse and note the first argument, which you are using because of positional matching. You want eval(parse(text = paste(...))) Best, Erik Iverson ______________________________________________ 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. ______________________________________________ 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.