Manish
Manish

Reputation: 3531

How to remove/hide column names in kable?

I am plotting a table using following code but I found there is unnecessary column names V1 and V2 appear as column name.

statdat<-read.table("stat.txt",sep="\t",header=FALSE)
kable(statdat) 

enter image description here

How can I avoid printing the column name?

Upvotes: 22

Views: 25038

Answers (1)

Martin
Martin

Reputation: 1201

You can set col.names to NULL to remove the column names:

kable(statdat, col.names = NULL) 

An alternative solution is to use format="pandoc" and cat() to select the relevant rows after the table has been created. This solution is given here: R- knitr:kable - How to display table without column names?

Upvotes: 37

Related Questions