r4ds/rmarkdown-demos/6-tables.Rmd

13 lines
290 B
Plaintext

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}
library(knitr)
kable(mtcars[1:5, ], caption = "A knitr kable.")
```