I use R to make neat graphs that I use in Microsoft Office documents. According to this page, the best quality is obtained with the PDF driver. Unfortunately, Word doesn't support importing PDF figures. What should I use?
|
|
If you are working on a PC, it is quite convenient to insert figures into Office documents in emf format via the clipboard. emf is a windows native vector graphics format and it allows you to edit the figures with MS Office tools. It's not perfect but it's a quick way of generating a simple report. If your documents are at all complicated, MS Word handling of figures is horrible. |
|||
|
|
|
Depends on how you will be using your Word documents and what types of figures you wish to include in the document. If the figures are standard R plots with a moderate number of points/data, then vector-based formats will provide the best reproduction and allow for easy rescaling of image size whilst having small filesize. EPS via If the plots could be considered rasters (surface plots or image plots [heatmaps] with a high number of "pixels"), or if the plots contain a very large number of points, retaining the vector information for such plots will result in a large file size and high processing costs to load into Word and store in memory as you are working on the document. In such cases, I would use a high-res TIFF or a PNG via Do consider also that not all devices support transparency, largely because the underlying file formats do not allow it; Do note that if saving your document out to PDF, bitmap figures will be downsampled to some degree. I forget how Word controls this, but it had two settings in the Save dialog when PDF type was selected and one of those will downsample the images to produce a smaller file size. This will be associated with some loss of quality so be careful which option you choose. This is not specific to Word - OpenOffice.org and LibreOffice have the same features, but they offer far finer grained control of how the images are compressed and whether they are compressed or not. This arises because PDF was designed for both on screen and on printer reproduction. You don't need the high resolution in images if displaying on the screen for the web. Higher res images result in larger file sizes, so the intended destination of the PDF could be set, which affected how the PDF was created. |
|||||
|
|
If you are on Windows try |
|||
|
|
|
R graphics in windows can be pretty tricky. The biggest problem that I have is that anti-aliasing is not working properly in Windows. For some reason I need to use the Cairo device plugin to get it nicely formatted. I've tried both Cairo and cairoDevice package and currently I find the cairoDevice to be the easiest and most reliable, there is a StackOverflow post about this. To use the cairoDevice package all you need is to:
You can also save in PDF/svg-format and then use Inkscape to edit your graph, change fonts etc and then export it to png format. |
|||
|
|
|
PDF, ps,SVG, or eps are vector based graphics device. JPG, TIFF,PNG,...etc are Raster graphics. When it comes raster graphics, the trade off is between the size and quality. By adjusting width,height and other formatting you could keep high quality in raster graphics. You could take PNG or JPG format to insert the image. SVG images may insert in MSWORD document. You can check this. |
|||
|
|
The easiest way migth be chosing |
|||
|
|
This does not directly answer your question, but you can get better integration between R and MS Word using either the R package R2wd or the commercial software Inference for R. These provide Sweave-like direct integration of R and MS Word, eliminating cut-and-paste or save-and-load, and making it easier to update plots in the document from the command line. I have not used these but I do use Sweave and recommend literate programming, which is supported by all of these tools. Sweave is the most widely used literate programmiing tool among R users. It is LaTeX + R, and is how R vignettes and many books and journal articles are written. The Word + R tools promise a less daunting interface for new users. LaTeX has a steeper learning curve than Word. However, at $199/yr, inference for R makes it challenging for others to reproduce your analyses, unlike Sweave, which is part of base R. |
||||
|
|