[R] save program results and graphs to one file

Jim Lemon drjimlemon at gmail.com
Mon Feb 2 09:30:31 CET 2015


Hi Ragia,
There are also the R2HTML and prettyR (see htmlize) packages that will
output an R session in HTML format.

Jim


On Mon, Feb 2, 2015 at 10:51 AM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:
> If you're happy with outputting to a multi-page PDF, then you can just
> set the default graphics device to pdf(), i.e.
>
>> options(device=pdf)
>
> and the start plotting:
>
>> plot(1:10, col=0)
>> plot(10:1, col=1)
>> plot((1:10)^2, col=2)
>> plot((10:1)^2, col=3)
>
> and at the end make sure to close the device:
>
>> dev.off()
>
> (The PDF device was automatically opened with the first plot call -
> all other figures are appended to this one.)
>
>
> This is what happens implicitly when you run a script in a
> non-interactive session, e.g.
>
>     Rscript -f myscript.R
>
> That is, in that case you don't have to set the 'device' options (it's
> done for you by default) and you don't have to close it at the end,
> because that is also done for you by default.
>
> /Henrik
>
>
>
> On Sun, Feb 1, 2015 at 2:53 PM, Bert Gunter <gunter.berton at gene.com> wrote:
>> But in addition to what Jeff noted, see ?save and ?save.image
>>
>> (noting that that the resulting .Rdata file can only be read by R).
>>
>> Cheers,
>> Bert
>>
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>> (650) 467-7374
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>> Clifford Stoll
>>
>>
>>
>>
>> On Sun, Feb 1, 2015 at 12:26 PM, Jeff Newmiller
>> <jdnewmil at dcn.davis.ca.us> wrote:
>>> In general this depends what you plan to do with those results. I suspect you are looking for something like knitr with rmarkdown (.Rmd files to create HTML or Word) or LaTeX (.Rnw files to create PDF).
>>> ---------------------------------------------------------------------------
>>> Jeff Newmiller                        The     .....       .....  Go Live...
>>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>>>                                       Live:   OO#.. Dead: OO#..  Playing
>>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>>> ---------------------------------------------------------------------------
>>> Sent from my phone. Please excuse my brevity.
>>>
>>> On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim <ragia11 at hotmail.com> wrote:
>>>>
>>>>Dear group,
>>>>
>>>>I have many plots and numeric results in my R program,  kindly how can
>>>>I save them all sequently on one file.
>>>>thanks in advance
>>>>RAI
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>>______________________________________________
>>>>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>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.
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list