Using knitr and R Markdown, I can produce a tabularised output from a matrix using the following command:
```{r results=\'asis\'}
kable(head(x))
```
<
I think other answers are from a time when the following didn't work, but now we can just do :
```{r results='asis', render=pander::pander}
head(x)
```
Or set this for all chunks in the setup chunk, for instance :
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, render=pander::pander)
```