By default, R Markdown displays data frames and matrices as they would be in the R terminal (in a monospaced font). If you prefer that data be displayed with additional formatting you can use the knitr::kable
function, as in the .Rmd file below. This file is available
here on RStudio Cloud.
Alternatively, open an interactive version of this article in your browser:
Note the use of the results='asis'
chunk option. This is required to ensure that the raw table output isn’t processed further by knitr.