That's because do.call wants a list:
what about this one:
> do.call( sprintf, append( list("C:\\Documents and
Settings\\Data\\comp_runoff_hd_%04d%02d.asc"), expand.grid(
seq(1986,1995), 1:12) ) )
Romain
Steve Murray wrote:
Dear all,
Thanks for the help in the previous posts. I've considered each one and have
nearly managed to get it working. The structure of the filelist being produced
is correct, except for a single space which I can't seem to eradicate! This is
my amended code, followed by the first twelve rows of the output (it really
goes up to 120 rows).
filelist <- paste("C:\\Documents and Settings\\Data\\comp_runoff_hd_",do.call(paste, expand.grid(year =
sprintf("%04d", seq(1986,1995)), month = sprintf("%02d",1:12))),".asc", sep="")
filelist
[1] "C:\\Documents and Settings\\Data\\comp1986 01.asc"
[2] "C:\\Documents and Settings\\Data\\comp1987 01.asc"
[3] "C:\\Documents and Settings\\Data\\comp1988 01.asc"
[4] "C:\\Documents and Settings\\Data\\comp1989 01.asc"
[5] "C:\\Documents and Settings\\Data\\comp1990 01.asc"
[6] "C:\\Documents and Settings\\Data\\comp1991 01.asc"
[7] "C:\\Documents and Settings\\Data\\comp1992 01.asc"
[8] "C:\\Documents and Settings\\Data\\comp1993 01.asc"
[9] "C:\\Documents and Settings\\Data\\comp1994 01.asc"
[10] "C:\\Documents and Settings\\Data\\comp1995 01.asc"
[11] "C:\\Documents and Settings\\Data\\comp1986 02.asc"
[12] "C:\\Documents and Settings\\Data\\comp1987 02.asc"
I've tried inserting sep="" after the 'month=sprintf("%02d",1:12)' but this
doesn't appear to solve the problem - in fact it doesn't change the output at all...!
Any help would be much appreciated,
Steve
______________________________________________
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.
--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
______________________________________________
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.