Easy way to copy paste base graph from R Studio into word document

Viewed 16856

I need to copy paste R graphs into MS Word.

rando<-rnorm(1:100)
plot(rando)

when I copy the .png graph from R Studio into Word I get a negative space version of the graph:

Is there a cleaner/easier way to do this? I would be happy to use pdf or something else to present the graph.

5 Answers

As @Roland suggested:

Export -> Copy Plot to Clipboard (window with plot will pop-out) -> Metafile -> Copy Plot -> Paste to MSWord.

This seems a lot of clicks to me, rather as @user2633645 suggested save all plots as png then insert them in MSWord in one go.

enter image description here

?png
rando<-rnorm(1:100)
png(filename = "rando.png")
plot(rando)
dev.off()

You can use the devEMF package. It is repeatable, easy to use, and converts very nicely to pdf if needed.

(wow is this an old question, but I guess it's still an issue. I'm on RStudio v1.3.1073)

I came across 3 options:

  1. Cross posting from https://github.com/rstudio/rstudio/issues/5103#issuecomment-679021780: "I've found two simple workarounds: Paste Special and choose TIFF, or (my preference) drag the image from the zoom window and drop in PowerPoint"
  2. Snipping tool
  3. You can specify the dimensions like in the RStudio plot export
windows(800,600) ## Opens graphic window. ctrl c/v works here.
plot(rando)

If you are doing this copy-plot-to-Word often or for several plots, consider creating an .Rmd file with your code, call knitr on that file, and use system("pandoc to convert your knitted .md file to Word.

Related