2

I'm using the texreg package to print LaTeX tables for my R linear models. The default settings of the package include printing many things which are irrelevant for my analysis. Luckily the package provides switches to turn many things off.

I have found through trial and error that things set as single.row=TRUE in R can be set as single_row=True in RPy.

As you can see in my notebook example here that works for single_row, and in the subsequent latex print confidence intervals are printed on the same row as my values.

The options include_loglik and include_deviance should control whether the Log Likelihood and the Deviance are printed. As I am not comparing models I do not need these. I have tried to set them as false via a number of different approaches but it just won't work.

Obviously everything works perfectly in pure R:

> texreg(lm, include.deviance=FALSE, include.loglik=FALSE)
Computing profile confidence intervals ...
Computing confidence intervals at a confidence level of 0.95. Use argument "method = 'boot'" for bootstrapped CIs.

\begin{table}
\begin{center}
\begin{tabular}{l c }
\hline
                         & Model 1 \\
\hline
(Intercept)              & $1.85^{*}$       \\
                         & $[1.60;\ 2.10]$  \\
COIem-hard               & $0.54^{*}$       \\
                         & $[0.38;\ 0.69]$  \\
COIsc-10                 & $0.19^{*}$       \\
                         & $[0.03;\ 0.34]$  \\
COIsc-14                 & $-0.04$          \\
                         & $[-0.20;\ 0.11]$ \\
COIsc-18                 & $-0.04$          \\
                         & $[-0.20;\ 0.12]$ \\
COIsc-22                 & $-0.01$          \\
                         & $[-0.16;\ 0.15]$ \\
COIsc-26                 & $-0.13$          \\
                         & $[-0.29;\ 0.02]$ \\
COIsc-6                  & $0.64^{*}$       \\
                         & $[0.48;\ 0.79]$  \\
\hline
AIC                      & 2342.49          \\
BIC                      & 2392.70          \\
Num. obs.                & 1120             \\
Num. groups: ID          & 7                \\
Variance: ID.(Intercept) & 0.08             \\
Variance: Residual       & 0.45             \\
\hline
\multicolumn{2}{l}{\scriptsize{$^*$ 0 outside the confidence interval}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}
\end{center}
\end{table}

Could you help me turn those switches off via RPy?

MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
TheChymera
  • 17,004
  • 14
  • 56
  • 86

1 Answers1

2

This is because these named parameters are not defined in the signature of the R function texreg::texreg (these arguments are passed through the ellipsis ...), and no safe attempt at conversion can be made by rpy2.

I have found through trial and error that thisgs set as single.row=TRUE in R can be set as single_row=True in RPy.

Consulting the documentation is an alternative to consider. Check out: http://rpy.sourceforge.net/rpy2/doc-2.3/html/robjects_functions.html

lgautier
  • 11,363
  • 29
  • 42
  • 1
    Ok, so this "Arguments falling in the ‘...’ will need to have their R names passed to the constructor" leads me to believe that the task is not impossible. I have tried the proposed `**{'include.loglik': False}` and it worked! please add this in your post so I can approve it as my answer. – TheChymera Nov 16 '13 at 14:13