[R] Output including listing and graphs.

Greg Snow 538280 at gmail.com
Sun Feb 9 04:17:26 CET 2014


As previously mentioned, the knitr package and related work well if
you have a script that you want to run.  If you want a basic R script
without worrying much about markup then I suggest looking at the spin
and stitch functions in the knitr packge.

If on the other hand you do not have a script prepared, but would
rather just type commands and have the transcript saved as you go
along, like the sink function but saving commands and graphs as well,
then have a look at the pander package (you need to specify which
pieces to save) or the txtStart and related functions in the
TeachingDemos package or similar functions in the R2HTML package.
These later ones have you run a  function to start saving the output,
run a function to include the current graph at that point in the
transcript (R cannot know if you are adding more or not) and another
function to stop saving.

On Sat, Feb 8, 2014 at 6:38 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 14-02-08 7:58 PM, John Sorkin wrote:
>>
>> R 3.0.0 or RStudio  0.98.490
>> Windows 7 (or Linux Mint)
>>
>> Is there any easy way to run an R program and have it produce text output
>> in a file along with any graphs that the code produces? I know I can run the
>> program and paste the graphs into the output however doing this is rather
>> time consuming.
>
>
> Besides the functions Jim told you about, there are Sweave (mainly for LaTeX
> output, but there is odfWeave) and knitr (several different output formats
> possible).  In fact, I believe knitr can work with Jim's functions.
>
> Duncan Murdoch
>
>
>> Thank you,
>> John
>>
>>
>>
>>
>> John David Sorkin M.D., Ph.D.
>> Professor of Medicine
>> Chief, Biostatistics and Informatics
>> University of Maryland School of Medicine Division of Gerontology and
>> Geriatric Medicine
>> Baltimore VA Medical Center
>> 10 North Greene Street
>> GRECC (BT/18/GR)
>> Baltimore, MD 21201-1524
>> (Phone) 410-605-7119
>> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>>
>> Confidentiality Statement:
>> This email message, including any attachments, is for the sole use of the
>> intended recipient(s) and may contain confidential and privileged
>> information.  Any unauthorized use, disclosure or distribution is
>> prohibited.  If you are not the intended recipient, please contact the
>> sender by reply email and destroy all copies of the original message.
>>
>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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
> 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com




More information about the R-help mailing list