John Kane
2025-Nov-21 15:57 UTC
[R] Best practice for copying statistical output from RStudio to Word using Times New Roman
I second Greg's recommendation. Creating a Quarto or Rmarkdown document and doing all text production and analysis in it is much more productive. It definitely makes changes and editing much easier and much less error prone. My personal preference is Quarto but either is several orders of magnitude better than cut and paste. On Fri, 21 Nov 2025 at 10:40, Greg Snow <538280 at gmail.com> wrote:> Here are a couple of things that I have found useful for when you need > the final results in MS Word and you want nice formatting. > > Use a quarto or Rmarkdown document and have knitr/pandoc create the > word document instead of copy/paste. The pander package does some > nice formatting for many of the statistical routines that pandoc > converts into tables. > > If you need to copy and paste, first copy and paste to MS Excel (and > for tables, you can use write.table with file="clipboard" and > sep="\t", then just paste in Excel). Then maybe make some adjustments > in Excel, then copy from Excel to Word, this will keep things as a > table in word, so changing the font will not mess with the alignment. > > The broom package takes output from lm models and puts them into data > frames (tibbles) that can be exported to Excel>Word instead of relying > on fixed width fonts and spaces for formatting. > > > On Fri, Nov 21, 2025 at 8:27?AM tgs77m--- via R-help > <r-help at r-project.org> wrote: > > > > The root cause is that RStudio?s output console is hardwired to use > monospaced fonts like Consolas, Courier, or Monaco, which preserve column > alignment. Times New Roman (TTR), being proportional, breaks that alignment > when pasted into Word unless you manually reformat. > > > > > > > > > > > > From: CALUM POLWART <polc1410 at gmail.com> > > Sent: Friday, November 21, 2025 5:02 AM > > To: Viechtbauer, Wolfgang (NP) < > wolfgang.viechtbauer at maastrichtuniversity.nl> > > Cc: Thomas Subia <tgs77m at yahoo.com>; r-help at r-project.org > > Subject: Re: [R] Best practice for copying statistical output from > RStudio to Word using Times New Roman > > > > > > > > As Wolfgang says. > > > > > > > > Ctrl-Shift-V and plain text. > > > > > > > > That said... I bet some of it looks awful as it's probably spaced for a > fixed width font. > > > > > > > > On Fri, 21 Nov 2025, 10:28 Viechtbauer, Wolfgang (NP) via R-help, < > r-help at r-project.org <mailto:r-help at r-project.org> > wrote: > > > > Dear Thomas, > > > > Just paste without formatting. Then the pasted text will be in the > active font of the Word document. > > > > Best, > > Wolfgang > > > > > -----Original Message----- > > > From: R-help <r-help-bounces at r-project.org <mailto: > r-help-bounces at r-project.org> > On Behalf Of tgs77m--- via R-help > > > Sent: Friday, November 21, 2025 07:51 > > > To: r-help at r-project.org <mailto:r-help at r-project.org> > > > Subject: [R] Best practice for copying statistical output from RStudio > to Word > > > using Times New Roman > > > > > > Colleagues > > > > > > I am writing an article using Microsoft Word for a journal that > requires > > > Times New Roman for all text (including tables and statistical > outputs). > > > However, copying console output from RStudio (e.g., summary(lm())) > into Word > > > retains the RStudio monospace font, and Word does not automatically > convert > > > it to Times New Roman. Manually restyling each pasted block is > > > time-consuming and error-prone. > > > > > > s there a recommended workflow for preserving proper alignment while > > > achieving Times New Roman text formatting when transferring statistical > > > results from RStudio into Word? > > > > > > System: > > > Windows 11 > > > R 4.5.1 > > > RStudio 2024.12.0+ > > > > > > Thanks for any guidance or best practices. > > > > > > Best regards, > > > Thomas Subia > > > > ______________________________________________ > > R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- To > UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > https://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 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- John Kane Kingston ON Canada [[alternative HTML version deleted]]
Charles-Édouard Giguère
2025-Nov-21 17:10 UTC
[R] Best practice for copying statistical output from RStudio to Word using Times New Roman
Hi,
I second the recommendation of using a Quarto or Rmarkdown. But sometimes, you
have to put your results into a word file.
Here?s my solution (see code below). This is a combination of the fmtr package
for formatting and the clip command in my package CUFF which is based on the
package clipr.
For example, say that you want to copy the anova results testing the different
diets in the chickwts package and put the contrasts in your word document. You
can use the following code. Once executed you can paste the results in your word
document in an already formatted table or alternatively as a raw text and then
use insert>table>Convert text in table.
Hope this helps.
Charles-?douard
R code:
library(fmtr)
library(CUFF)
library(emmeans)
lm_diets <- lm(weight ~ feed, chickwts)
anova(lm_diets)
(emm_diets <- emmeans(lm_diets, pairwise ~ feed))
### Suppose, I want to display the contrasts in word.
### 1. put it in a data.frame and format it the way you want.
### Tips: you can reuse your formats.
anova.fmt <- list(estimate = "%.2f",
SE = "%.1f",
df = "%d",
t.ratio = "%.3f",
p.value = pv # format as APA formating guide
)
emm_diets.df <- data.frame(emm_diets$contrasts)
formats(emm_diets.df) <- anova.fmt
### 2. Then you clip to put it in your word document.
clip(
fdata(emm_diets.df)
)
### for output without col.names see help(clip) for details.
clip(
fdata(emm_diets.df), col.names = FALSE
)
Charles-?douard Gigu?re
Centre de recherche de l' Institut universitaire en sant? mentale de
Montr?al
7331 rue Hochelaga, Montr?al, QC, H1N 3V2
Unit? 228, Pavillon Riel, Local RI-226-87
514-251-4015 #3516
cedouard-giguere.iusmm at ssss.gouv.qc.ca <mailto:cedouard-giguere.iusmm at
ssss.gouv.qc.ca>
www.centresignature.ca <http://www.centresignature.ca>
Le ven. 21 nov. 2025, 10 h 58?a.m., John Kane < <mailto:jrkrideau at
gmail.com> jrkrideau at gmail.com> a ?crit :
I second Greg's recommendation. Creating a Quarto or Rmarkdown
document and doing all text production and analysis in it is much more
productive. It definitely makes changes and editing much easier and much
less error prone.
My personal preference is Quarto but either is several orders of magnitude
better than cut and paste.
On Fri, 21 Nov 2025 at 10:40, Greg Snow < <mailto:538280 at gmail.com>
538280 at gmail.com> wrote:
> Here are a couple of things that I have found useful for when you need
> the final results in MS Word and you want nice formatting.
>
> Use a quarto or Rmarkdown document and have knitr/pandoc create the
> word document instead of copy/paste. The pander package does some
> nice formatting for many of the statistical routines that pandoc
> converts into tables.
>
> If you need to copy and paste, first copy and paste to MS Excel (and
> for tables, you can use write.table with file="clipboard" and
> sep="\t", then just paste in Excel). Then maybe make some
adjustments
> in Excel, then copy from Excel to Word, this will keep things as a
> table in word, so changing the font will not mess with the alignment.
>
> The broom package takes output from lm models and puts them into data
> frames (tibbles) that can be exported to Excel>Word instead of relying
> on fixed width fonts and spaces for formatting.
>
>
> On Fri, Nov 21, 2025 at 8:27?AM tgs77m--- via R-help
> < <mailto:r-help at r-project.org> r-help at r-project.org>
wrote:
> >
> > The root cause is that RStudio?s output console is hardwired to use
> monospaced fonts like Consolas, Courier, or Monaco, which preserve column
> alignment. Times New Roman (TTR), being proportional, breaks that alignment
> when pasted into Word unless you manually reformat.
> >
> >
> >
> >
> >
> > From: CALUM POLWART < <mailto:polc1410 at gmail.com> polc1410
at gmail.com>
> > Sent: Friday, November 21, 2025 5:02 AM
> > To: Viechtbauer, Wolfgang (NP) <
> <mailto:wolfgang.viechtbauer at maastrichtuniversity.nl>
wolfgang.viechtbauer at maastrichtuniversity.nl>
> > Cc: Thomas Subia < <mailto:tgs77m at yahoo.com> tgs77m at
yahoo.com>; <mailto:r-help at r-project.org> r-help at r-project.org
> > Subject: Re: [R] Best practice for copying statistical output from
> RStudio to Word using Times New Roman
> >
> >
> >
> > As Wolfgang says.
> >
> >
> >
> > Ctrl-Shift-V and plain text.
> >
> >
> >
> > That said... I bet some of it looks awful as it's probably spaced
for a
> fixed width font.
> >
> >
> >
> > On Fri, 21 Nov 2025, 10:28 Viechtbauer, Wolfgang (NP) via R-help, <
> <mailto:r-help at r-project.org> r-help at r-project.org <mailto:
<mailto:r-help at r-project.org> r-help at r-project.org> > wrote:
> >
> > Dear Thomas,
> >
> > Just paste without formatting. Then the pasted text will be in the
> active font of the Word document.
> >
> > Best,
> > Wolfgang
> >
> > > -----Original Message-----
> > > From: R-help < <mailto:r-help-bounces at r-project.org>
r-help-bounces at r-project.org <mailto:
> <mailto:r-help-bounces at r-project.org> r-help-bounces at
r-project.org> > On Behalf Of tgs77m--- via R-help
> > > Sent: Friday, November 21, 2025 07:51
> > > To: <mailto:r-help at r-project.org> r-help at
r-project.org <mailto: <mailto:r-help at r-project.org> r-help at
r-project.org>
> > > Subject: [R] Best practice for copying statistical output from
RStudio
> to Word
> > > using Times New Roman
> > >
> > > Colleagues
> > >
> > > I am writing an article using Microsoft Word for a journal that
> requires
> > > Times New Roman for all text (including tables and statistical
> outputs).
> > > However, copying console output from RStudio (e.g.,
summary(lm()))
> into Word
> > > retains the RStudio monospace font, and Word does not
automatically
> convert
> > > it to Times New Roman. Manually restyling each pasted block is
> > > time-consuming and error-prone.
> > >
> > > s there a recommended workflow for preserving proper alignment
while
> > > achieving Times New Roman text formatting when transferring
statistical
> > > results from RStudio into Word?
> > >
> > > System:
> > > Windows 11
> > > R 4.5.1
> > > RStudio 2024.12.0+
> > >
> > > Thanks for any guidance or best practices.
> > >
> > > Best regards,
> > > Thomas Subia
> >
> > ______________________________________________
> > <mailto:R-help at r-project.org> R-help at r-project.org
<mailto: <mailto:R-help at r-project.org> R-help at r-project.org>
mailing list -- To
> UNSUBSCRIBE and more, see
> > <https://stat.ethz.ch/mailman/listinfo/r-help>
https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> <https://www.R-project.org/posting-guide.html>
https://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > <mailto:R-help at r-project.org> R-help at r-project.org
mailing list -- To UNSUBSCRIBE and more, see
> > <https://stat.ethz.ch/mailman/listinfo/r-help>
https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> <https://www.R-project.org/posting-guide.html>
https://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> <mailto:538280 at gmail.com> 538280 at gmail.com
>
> ______________________________________________
> <mailto:R-help at r-project.org> R-help at r-project.org mailing
list -- To UNSUBSCRIBE and more, see
> <https://stat.ethz.ch/mailman/listinfo/r-help>
https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> <https://www.R-project.org/posting-guide.html>
https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
John Kane
Kingston ON Canada
[[alternative HTML version deleted]]
______________________________________________
<mailto:R-help at r-project.org> R-help at r-project.org mailing list --
To UNSUBSCRIBE and more, see
<https://stat.ethz.ch/mailman/listinfo/r-help>
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
<https://www.R-project.org/posting-guide.html>
https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
tgs77m m@iii@g oii y@hoo@com
2025-Nov-22 15:11 UTC
[R] Best practice for copying statistical output from RStudio to Word using Times New Roman
Thanks all! This is an elegant solution! TS From: John Kane <jrkrideau at gmail.com> Sent: Friday, November 21, 2025 7:58 AM To: Greg Snow <538280 at gmail.com> Cc: tgs77m at yahoo.com; r-help at r-project.org Subject: Re: [R] Best practice for copying statistical output from RStudio to Word using Times New Roman I second Greg's recommendation. Creating a Quarto or Rmarkdown document and doing all text production and analysis in it is much more productive. It definitely makes changes and editing much easier and much less error prone. My personal preference is Quarto but either is several orders of magnitude better than cut and paste. On Fri, 21 Nov 2025 at 10:40, Greg Snow <538280 at gmail.com <mailto:538280 at gmail.com> > wrote: Here are a couple of things that I have found useful for when you need the final results in MS Word and you want nice formatting. Use a quarto or Rmarkdown document and have knitr/pandoc create the word document instead of copy/paste. The pander package does some nice formatting for many of the statistical routines that pandoc converts into tables. If you need to copy and paste, first copy and paste to MS Excel (and for tables, you can use write.table with file="clipboard" and sep="\t", then just paste in Excel). Then maybe make some adjustments in Excel, then copy from Excel to Word, this will keep things as a table in word, so changing the font will not mess with the alignment. The broom package takes output from lm models and puts them into data frames (tibbles) that can be exported to Excel>Word instead of relying on fixed width fonts and spaces for formatting. On Fri, Nov 21, 2025 at 8:27?AM tgs77m--- via R-help <r-help at r-project.org <mailto:r-help at r-project.org> > wrote:> > The root cause is that RStudio?s output console is hardwired to use monospaced fonts like Consolas, Courier, or Monaco, which preserve column alignment. Times New Roman (TTR), being proportional, breaks that alignment when pasted into Word unless you manually reformat. > > > > > > From: CALUM POLWART <polc1410 at gmail.com <mailto:polc1410 at gmail.com> > > Sent: Friday, November 21, 2025 5:02 AM > To: Viechtbauer, Wolfgang (NP) <wolfgang.viechtbauer at maastrichtuniversity.nl <mailto:wolfgang.viechtbauer at maastrichtuniversity.nl> > > Cc: Thomas Subia <tgs77m at yahoo.com <mailto:tgs77m at yahoo.com> >; r-help at r-project.org <mailto:r-help at r-project.org> > Subject: Re: [R] Best practice for copying statistical output from RStudio to Word using Times New Roman > > > > As Wolfgang says. > > > > Ctrl-Shift-V and plain text. > > > > That said... I bet some of it looks awful as it's probably spaced for a fixed width font. > > > > On Fri, 21 Nov 2025, 10:28 Viechtbauer, Wolfgang (NP) via R-help, <r-help at r-project.org <mailto:r-help at r-project.org> <mailto:r-help at r-project.org <mailto:r-help at r-project.org> > > wrote: > > Dear Thomas, > > Just paste without formatting. Then the pasted text will be in the active font of the Word document. > > Best, > Wolfgang > > > -----Original Message----- > > From: R-help <r-help-bounces at r-project.org <mailto:r-help-bounces at r-project.org> <mailto:r-help-bounces at r-project.org <mailto:r-help-bounces at r-project.org> > > On Behalf Of tgs77m--- via R-help > > Sent: Friday, November 21, 2025 07:51 > > To: r-help at r-project.org <mailto:r-help at r-project.org> <mailto:r-help at r-project.org <mailto:r-help at r-project.org> > > > Subject: [R] Best practice for copying statistical output from RStudio to Word > > using Times New Roman > > > > Colleagues > > > > I am writing an article using Microsoft Word for a journal that requires > > Times New Roman for all text (including tables and statistical outputs). > > However, copying console output from RStudio (e.g., summary(lm())) into Word > > retains the RStudio monospace font, and Word does not automatically convert > > it to Times New Roman. Manually restyling each pasted block is > > time-consuming and error-prone. > > > > s there a recommended workflow for preserving proper alignment while > > achieving Times New Roman text formatting when transferring statistical > > results from RStudio into Word? > > > > System: > > Windows 11 > > R 4.5.1 > > RStudio 2024.12.0+ > > > > Thanks for any guidance or best practices. > > > > Best regards, > > Thomas Subia > > ______________________________________________ > R-help at r-project.org <mailto:R-help at r-project.org> <mailto:R-help at r-project.org <mailto:R-help at r-project.org> > mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://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 <mailto:538280 at gmail.com> ______________________________________________ R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John Kane Kingston ON Canada [[alternative HTML version deleted]]