Re: [R] Save generic plot to file (before rendering to device)

2011-08-01 Thread Jeroen Ooms
Bumping this one up because the 'before.plot.new' solution turned out to be sub-optimal after all. >> It should be possible to do this with a before.plot.new hook, right? > > Yes, sure, if you treat the first and last plot separately. It turns out that the before.plot.new hook does not is not tri

Re: [R] Save generic plot to file (before rendering to device)

2011-07-17 Thread peter dalgaard
On Jul 11, 2011, at 22:08 , Greg Snow wrote: > Note the warning on the help page for recordPlot. If your colleague is using > a different version of R than you there could be problems. Also notice that the process isn't perfect, as people occasionally discover when they use dev.copy() and its

Re: [R] Save generic plot to file (before rendering to device)

2011-07-17 Thread Jeroen Ooms
Thanks I didn't know about that. I ended up with something like this. Is there a more elegant way to do it? myplots <<- list(); hasplots <<- FALSE; setHook("before.plot.new", function(...) {     if(hasplots == FALSE){       hasplots <<- TRUE;     } else {       myplots[[length(myplots)+1]] <<- rec

Re: [R] Save generic plot to file (before rendering to device)

2011-07-16 Thread Uwe Ligges
On 16.07.2011 20:17, Hadley Wickham wrote: Thank you, this is very helpful. One final question regarding this method: suppose a function prints multiple plots, i.e. multiple pages to a PDF. Is it possible to record all of these plots at once? The code below only records the final plot. I would

Re: [R] Save generic plot to file (before rendering to device)

2011-07-16 Thread Hadley Wickham
>> Thank you, this is very helpful. One final question regarding this method: >> suppose a function prints multiple plots, i.e. multiple pages to a PDF. Is >> it possible to record all of these plots at once? The code below only >> records the final plot. I would like to record all of them, without

Re: [R] Save generic plot to file (before rendering to device)

2011-07-16 Thread Uwe Ligges
.org Subject: Re: [R] Save generic plot to file (before rendering to device) You can also save a data (or function) object to an .Rdata file with save(objname, file="filename.Rdata") and your colleagues could then load("filename.Rdata") in R. Thanks for the responses. I fou

Re: [R] Save generic plot to file (before rendering to device)

2011-07-16 Thread Jeroen Ooms
;> greg.s...@imail.org >> 801.408.8111 >> >> >> -Original Message- >>> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >>> project.org] On Behalf Of Jeroen Ooms >>> Sent: Monday, July 11, 2011 12:22 PM >>> To: David

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread Greg Snow
r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Jeroen Ooms > Sent: Monday, July 11, 2011 12:22 PM > To: David Winsemius > Cc: r-help@r-project.org > Subject: Re: [R] Save generic plot to file (before rendering to device) > > > > > Y

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread Jeroen Ooms
> > You can also save a data (or function) object to an .Rdata file with > save(objname, file="filename.Rdata") and your colleagues could then > load("filename.Rdata") in R. > Thanks for the responses. I found an old post by Gabor Grothendieck that shows what I want. Basically the trick is to sav

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 12:08 PM, jeroen00ms wrote: I am looking for a way to save a plot (graphics contents) to a file after the plot has been calculated but before it has been rendered. More specifically, assume that I made a plot that took a very long time to produce, I would like to save t

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread John Sorkin
After the plot is created, you can save the graph as a pdf document (file menu, save as). You can then send the pdf file to your colleagues. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Me

[R] Save generic plot to file (before rendering to device)

2011-07-11 Thread jeroen00ms
I am looking for a way to save a plot (graphics contents) to a file after the plot has been calculated but before it has been rendered. More specifically, assume that I made a plot that took a very long time to produce, I would like to save this plot to a generic file that I can later, on a differe