4

I'm trying to create simple tables with R Markdown (.Rmd), using RStudio. The most customizable and easily applicable way I found is xtable package. Even though xtable should produce a table with horizontal lines by default. What I should get would be like this (or these), but what I get is this. I cannot get it with following code:

```{r,results='asis'}
library(xtable)
tTable <- xtable(head(mtcars))
print(tTable,type="html",hline.after=c(-1,0))

tTable <- xtable(lm(mpg ~ hp, data = mtcars))
print(tTable,type="html")

```

Where am I wrong?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
HBat
  • 4,873
  • 4
  • 39
  • 56
  • 1
    The examples you show are `LaTeX` tables and you produce a `html` table. Perhaps there is no such thing as horizontal line in html tables produced by `xtable`. Perhaps using `ascii` helps. – Henrik Jun 05 '13 at 18:23
  • @Henrik I guessed that too. Just want to double check if I'm wrong. I'll look over `ascii`. Thanks for input. – HBat Jun 05 '13 at 19:45
  • As @Henrik pointed out, your examples are in PDF files, while you are generating HTML. You can still achieve a similar look, just Google for CSS stylesheets. – daroczig Feb 07 '15 at 05:19

0 Answers0