[EMAIL PROTECTED] wrote:

Use list.files(). It has a path argument (to specify the directory) and a pattern argument to put the regular expression.

mygraphs <- list.files(path="./mygraphs", pattern="^ANCbwplot.*\\.eps")

See ?list.files and maybe ?regex

HTH,
Tobias

Hi Tobias.

Thanks for the reply. I just found list.files() but was struggling with specifying the pattern argument. I have this working very well now for my application like so in a Sweave file:

<<echo=FALSE,results=tex>>=
postscript(file = "ANCbwplot%03d.eps", onefile = FALSE,
           paper = "special", width = 4, height = 6,
           horizontal = FALSE)
oldpar <- par(mfrow = c(4,3))
for (i in seq(along = g1865.w.res99))
  {
    multplot(g1865.w.res99[[i]], m.title = names(g1865.w.res99[i]))
  }
par(oldpar)
invisible(dev.off())
graphs <- list.files(pattern = "^ANCbwplot.*\\.eps")
for (i in seq(along = graphs))
  {
    cat("\\includegraphics{", graphs[i], "}\n\n", sep = "")
  }
@

multplot() is just a helper function that extracts the relevant information from the list g1865.w.res99 and plots a boxplot

Many thanks for your help,

Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] [EMAIL PROTECTED]
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to