[R] Exporting R graphics into Word without losing graph quality

Greg Snow 538280 at gmail.com
Wed Dec 18 21:29:20 CET 2013


Another option to consider if your goal is to create a word file with
1 or more plots in it (possibly intermingled with text and other
output) is to use the knitr or pander packages (or odfWeave or sweave
or ...).  This way you can create a script (or template file) that
sets a couple of options up front (width, height, resolution, file
type) and creates the graphs (and possibly other output to be
included), run the script (and maybe the external program pandoc) and
you have a word document with the plots without needing to copy/paste
or import.

This becomes a real time saver when the client comes back to you and
says there was a typo in the data, the 13 on line 27 needs to be an 18
and can you rerun everything with that change?  (if something along
those lines has not happened to you yet, it will).

On Mon, Dec 16, 2013 at 9:33 PM, david hamer <j.david.hamer at gmail.com> wrote:
> Thanks to everyone for the helpful suggestions.   --   David.
>
>
> On Mon, Dec 16, 2013 at 7:23 PM, Steve Taylor <steve.taylor at aut.ac.nz>wrote:
>
>> > From: Duncan Murdoch...
>>
>> > Don't use a bitmap format (png).
>> I disagree.  Each vector format comes with its own problems.
>>
>> > Don't produce your graph in one format (screen display), then convert to
>> > another (png).  Open the device in the format you want for the final
>> file.
>> Agreed.
>>
>> > Use a vector format for output.
>> Why?  Sure, that's good advice in the ideal (pdflatex) world, but not
>> necessarily the best of advice for Word users.
>>
>> > I don't know what kinds Word supports, but
>> > EPS or PDF would likely be best; if it can't read those, then Windows
>> metafile
>> > (via windows() to open the device) would be best.
>> None of these works well, if at all, in my experience with Word.
>>
>> > Don't use Word.
>> Some of us don't really have a choice.
>>
>>
>>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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