Using the iris data, we make a table with the tables
package:
library(tables)
table <- tabular( (Sepal.Length+Sepal.Width) ~
Format(format(digits=2))*(mean + sd), data=iris )
With the Hmisc
package, we would add the caption with the latex
function like this:
latex(table, caption="My table")
But that does not work with the tables
package, because it defines an S3 method, latex.tabular
.
So I have tried this, following an example in the package vignette:
latex(table, options=list(toprule="\\caption{My table}"))
But it does not work, it says that caption is outside float. How can I correctly add caption with the latex.tabular
function from the tables
package?