我正在使用texreg package为我的R线性模型打印LaTeX表。该软件包的默认设置包括打印许多与我的分析无关的内容。幸运的是,这个包提供了开关来关闭许多东西。
经过反复试验,我发现在R中设置为single.row=TRUE的东西在RPy中也可以设置为single_row=True。
正如您在我的notebook example here中看到的,它适用于single_row,并且在随后的latex打印中,置信度区间与我的值打印在同一行。
选项include_loglik和include_deviance应控制是否打印对数似然和偏差。因为我不是在比较模型,所以我不需要这些。我尝试过通过许多不同的方法将它们设置为false,但就是不起作用。
显然,在纯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}你能帮我通过RPy关闭这些开关吗?
发布于 2013-11-16 21:52:08
这是因为这些命名参数没有在R函数texreg::texreg的签名中定义(这些参数通过省略号...传递),并且rpy2不能进行安全的转换尝试。
经过反复试验,我发现在R中设置为single.row=TRUE的
可以在RPy中设置为single_row=True。
参考文档是一种可以考虑的替代方案。查看:http://rpy.sourceforge.net/rpy2/doc-2.3/html/robjects_functions.html
https://stackoverflow.com/questions/20018848
复制相似问题