r4ds/rmarkdown-demos/6-tables.Rmd

19 lines
356 B
Plaintext

---
title: "Tables"
output: html_document
---
By default, R Markdown displays data frame and matrix output as it would appear at the command line:
```{r echo = FALSE}
mtcars[1:5, ]
```
Format the output as a table with knitr's `kable` function:
```{r echo = FALSE, results = 'asis'}
library(knitr)
kable(mtcars[1:5, ], caption = "A knitr kable.")
```