[R-SIG-Finance] subscripting variable names?

Charles Evans cevans at chyden.net
Thu Jun 4 23:34:39 CEST 2009


Hello!

Is there any function that will let me tell R to create plot 1 and  
save it to my hard drive as plot01.png, create plot 2 and save it to  
my hard drive as plot02.png, etc.

I am running several batches of plots that I want to save for use in  
the appendices of my dissertation.  The kludge that I have come up  
with is:

for (i in 1:dim(p)[3]) {
png(width=800,height=640,units="px",bg="white")
plot(residuals(lm(p[,1,i]~n[,1,i],na.action=na.omit)),ylab=i)
}

Then, I use dev.off() to save the top graphic in the stack, rename the  
file on my computer, and repeat.

I have tried using cat() to create indexed filenames, but that did not  
work.  After a couple hours of searching online, I have not been able  
to find a solution.

Any hints would be appreciated.

Yours,

C.Evans

Capital goes where it's welcome and stays where it's well treated.
Walter B. Wriston



More information about the R-SIG-Finance mailing list