Is there a way to repeat the top row / set headers when generating an xtable with a longtable option ?
For eg., if I have
tableSb <- xtable(df, caption="A Very Long Table", label="ALongTable")
print(tableSb, include.rownames=TRUE, tabular.environment="longtable", floating=FALSE)
This works fine, but when the tables roll over into a new page the headers are not repeated. Any suggestions ?
In order to accomplish this, you’ll need to use the
add.to.rowoption of theprintfunction (run?print.xtablefor more information).Try this (adapted from a post on R-Forge)
It’s a bit clumsy of a solution, but at least it’ll provide you with plenty of customization.