How to remove/hide column names in kable?

Manish picture Manish · Jul 18, 2018 · Viewed 10.3k times · Source

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?

Answer

Martin picture Martin · Nov 7, 2018

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?