Topic 10: Inserting tables

TO UPDATE THIS PAGE: Open and edit the topic_10.Rmd file, in the project root, to delete this placeholder text and customize with your own!

Use the Visual Editor

If you want to create a table in your R Markdown from scratch that is easily editable (e.g., a table of Assignment due dates or something), it might be easiest to just make the thing manually right in your R Markdown document.

To do that, I strongly recommend using the RStudio Visual Editor (in RStudio versions >= 1.4), which has an easy-to-use Table maker similar to what you’d see in Word or Google Docs.

  1. Open the .Rmd in which you want to add the table
  2. Switch over to the visual editor by clicking on the compass-looking icon in the top right of your .Rmd screen, to the right of the ‘Run’ and ‘Publish’ buttons (hover text is “Switch to visual markdown editor”)
  3. In the Visual Editor menu, click on Table, then in the dropdown Menu click ‘Insert Table’…and create & populate your new table like you would normally in non-markdown tools

Other options

There are a bunch of different ways to add & format tables in R Markdown (see several of many options in David Keyes’ post on Making Beautiful Tables in R). I think most of them are most useful when you’re trying to make a finalized table with data in it, but if you really want to beautify your website tables there are options.