Avinash
Avinash

Reputation: 2561

Is it possible to give vertical lines separating columns in kable function in knitr?

I would like to give vertical lines between columns in the table being rendered. It shows on the R console. But not in the html document.

> kable(data.frame(1:10,11:20,21:30))


| X1.10| X11.20| X21.30|
|-----:|------:|------:|
|     1|     11|     21|
|     2|     12|     22|
|     3|     13|     23|
|     4|     14|     24|
|     5|     15|     25|
|     6|     16|     26|
|     7|     17|     27|
|     8|     18|     28|
|     9|     19|     29|
|    10|     20|     30|

enter image description here

I would also like to the shift the table to the left. I can make it another question if needed.

Upvotes: 2

Views: 2632

Answers (1)

ABC2013
ABC2013

Reputation: 162

I believe it's an issue with the HTML css.

You can easily change the html css style in R markdown YAML as follow:

---
title: "Sample Document"
output:
  html_document:
     toc: true
     theme: united
---

You can read more about it here under Output Options section.

Upvotes: 2

Related Questions