Reputation: 1200
Hmisc::latex() seems to ignore all the arguments I give it, other than object
. It's hard to point to a specific question I need answered, other than -- "How can I get Hmisc::latex()" to recognize the arguments its documentation says it should?
For example, these two commands produce the same output:
library(Hmisc)
library(tables)
t <- tabular(Species ~ (Sepal.Length + Sepal.Width)*(mean + sd), data = iris)
latex(object = t)
latex(object = t, booktabs = TRUE, align = rep('r', 5))
The output I get from both of these commands is:
\begin{tabular}{lcccc}
\hline
& \multicolumn{2}{c}{Sepal.Length} & \multicolumn{2}{c}{Sepal.Width} \\
Species & mean & sd & mean & \multicolumn{1}{c}{sd} \\
\hline
setosa & $5.006$ & $0.3525$ & $3.428$ & $0.3791$ \\
versicolor & $5.936$ & $0.5162$ & $2.770$ & $0.3138$ \\
virginica & $6.588$ & $0.6359$ & $2.974$ & $0.3225$ \\
\hline
\end{tabular}
I am using Hmisc 4.0-2 and tables 0.8 on R 3.2.2.
Edit: the caption
and caption.loc
arguments seem to be ignored as well. But if I run booktabs()
prior to running latex()
, that does take effect (changes the formatting of the table).
Upvotes: 1
Views: 1719
Reputation: 1200
@rcorty from two days ago -- you are misunderstanding what R
does when you call latex()
on your object of class tabular
. You believe that it's running Hmisc::latex()
, the default S3 method for the latex
generic. But what's really happening is R
is running tables::latex()
, the S3 method for objects of class tabular
, which is the class of the objects you have.
Have a look at the documentation for tables::latex()
and you'll see what arguments you can use.
Though, it is a bit weird that you're not getting any error about unused arguments.
Upvotes: 1