Formatting a Table in Word | R to Tab-Delimited to APA Style

September 25, 2009

(This article was first published on Jeromy Anglim's Blog: Psychology and Statistics, and kindly contributed to R-bloggers)

The following post sets out my procedure for importing a tab-delimited table of data produced in R  into Microsoft Word and formatting it.
Prior to importing table:

  1. Run macro which does the following
    1. Insert Caption: References – Insert Caption (Label  = Table)
    2. Insert line for Table Title and assign style Table Title (i.e., an italicised style)
    3. Insert line for table to be placed and assign style (Table Text).

Importing and Formatting Table:

  1. Copy the tab-delimited text file and Paste into desired locations of Word document
  2. Convert to table: Insert – Table – Convert Text To Table (Separate = Tabs)
  3. Format table
    1. Assign Style to content of table (mine is called Table Text)
    2. Italicise: e.g., “Note”, some statistics
    3. Superscript: specific notes, exponents (e.g., R^2)
    4. Characters not allowed in R (e.g., dash)
    5. Adjust column widths
    6. Adjust cell alignment
      1. decimal tab (select numeric columns; paragraph dialog box; tabs; tab stop position = 1cm; alignment = decimal)
      2. centred 
      3. left-aligned for row names
    7. Mark lines
      1. Remove all lines
      2. Add lines, typically 3 rows (above 1st; below 1st; below last)
    8. Check table accuracy
    9. Interpret and add describing text; to ensure text stays up to date as tables are added and deleted, insert a cross reference to the Table Caption (Reference – Cross-Reference: Reference Type = Table; Insert Reference to = Only label and number)
    10. Change status in output meta-file: I have an Excel spreadsheet which lists all tables that need to be created. Once a table is created it is recorded as done in the spreadsheet.

Future refinements: I am looking into ways of automating more of the above possibly by using a little meta data (to store column width information, alignment, and so on), a little mark up language (to handle superscripts, italics, special characters), and a vb macro to apply the meta data and markup language in Word.

To leave a comment for the author, please follow the link and comment on their blog: Jeromy Anglim's Blog: Psychology and Statistics. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

plotly webpage

dominolab webpage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training




CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)