Re: [R] Concatenate variables and quoted text for output filenames

From: Wolfgang Huber <>
Date: Tue, 29 Apr 2008 17:17:54 +0100

29/04/2008 17:04 trhermes a écrit
> I am outputting some graphs from SpatStat using a for loop. I want the png
> files to include the i and j from the nested loops in their names. For
> example, I want the file names to look like "i-j_plot.png". The code is
> below:
> ma <- levels(marks(X))
> n <- length(ma)
> for(i in 1:n)
> for(j in 1:n)
> {
> png(filename=????)
> plot(envelope(X, Kcross, i=ma[i], j=ma[j]))
> }

  png(filename=sprintf("%d-%d_plot.png", i, j))

Best wishes

Wolfgang Huber  EBI/EMBL  Cambridge UK

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 29 Apr 2008 - 17:40:23 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 Tue 29 Apr 2008 - 18:30:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive