How to copy R console output into a word document

How can I copy the output of the R console into a word document?
Please let me know

1 Like

Select what you want in the console and copy. Then in Word paste using Keep Text Only. (Right click to get the paste options.) There does seem to be something odd in how copying from the console works.

I'm not sure you can. I think there's something a little funky in the RStudio copy command.

I want to summarize my lecture slides and add some RStudio codes/outputs.
What would be the best option?

What I did in this situation is use RMarkdown and made output to Beamer. Getting the R Code and output displayed works well. A good starting point is

Paste special doesn't least not for me.

I have copied all sorts of R outputs like tables and scripts into excel and then into Word and it usually works.
If it's for a presentation you could always do a screen shot!

Copy-Paste to word document and change the font of the text in the word document to monospaced (eg. Courier New).

Pls also give sink(file=your file.txt) a try to output all your console output to "txt" file and then copy+paste to your MSWord with required formatting.

You can use rmarkdown and produce a word file or a powerpoint (whichever you prefer). Then you can copy and paste from there. For starting with rmarkdown see:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

I want to keep the formatting.
How should I do it?