RStudio and R Markdown Tips

Page content

Here are some miscellaneous tips for working on RStudio and writing R Markdown file. It will be updated from time to time.

See also:

1. RStudio

1.1 Re-view generated html file in RStudio

If need to view closed html result file, simply run:


2. R Markdown

2.1 Show code but not run

Add eval=FALSE in chunk option.

2.2 Output data frames as tables

Use kable(data, caption):

data <- faithful[1:4,]

             caption = "Table with kable")

For a nice-looking table, the package htmlTable what you need.


htmlTable(data, caption = "Table with htmlTable")


  1. View markdown generated html in RStudio viewer
  2. Include code that does not run in Rpresentation Markdown