r4ds/rmarkdown-demos/6-tables.Rmd

13 lines
290 B
Plaintext
Raw Normal View History

2016-08-19 01:40:09 +08:00
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:
2016-08-22 22:31:17 +08:00
```{r echo = FALSE}
2016-08-19 01:40:09 +08:00
library(knitr)
kable(mtcars[1:5, ], caption = "A knitr kable.")
```