20

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Manish
  • 3,341
  • 15
  • 52
  • 87

1 Answers1

34

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?

Martin
  • 1,141
  • 14
  • 24