phez1 phez1 - 3 months ago 21
R Question

The tables in the .Rmd file are not displayed properly when exporting the file to HTML

I have a .Rmd file and I want to export it to a HTML file.
But the tables look wrong. In Rstudio the table looks good:

enter image description here

But when I export it to HTML (or PDF, Word, clicking on 'Knit'), then the table is not displayed properly:

enter image description here

Answer Source

Maybe you are looking for kable, which can output md table, and set the results option to asis.

```{r, results='asis'}
efficient <- mtcars[mtcars$mpg > 23,]
knitr::kable(efficient)
```