如何从R/RSweave/LaTeX上的lm的xtable()输出中删除"标准错误"列

Luc*_*her 6 latex r xtable

我目前正在对人口数据进行一些数据分析,因此报告参数系数表中的标准误差实际上并没有统计意义.我做了很多搜索,找不到任何方法来自定义xtable输出来删除它.谁能指出我正确的方向?

非常感谢,我没有轻易发布; 如果这是明显的事情,我为浪费时间而道歉!

Ric*_*rta 5

在我(其他)整个冗长的回答之后......这也有效:

xtable(summary(model1)$coefficients[,c(1,3,4)])
Run Code Online (Sandbox Code Playgroud)

或者更一般地说:

sm <- summary(SomeModel)
SE.indx <- which(colnames(sm$coefficients) == "Std. Error")   # find which column is Std. Error (usually 2nd)
sm$coefficients <- sm$coefficients[, -SE.indx]  # Remove it
xtable(sm$coefficients)   # call xtable on just the coefficients table
Run Code Online (Sandbox Code Playgroud)

结果:

% latex table generated in R 2.15.1 by xtable 1.7-0 package
% Sun Dec  9 00:01:46 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrr}
  \hline
 & Estimate & t value & Pr($>$$|$t$|$) \\ 
  \hline
(Intercept) & 29.80 & 30.70 & 0.00 \\ 
  crim & -0.31 & -6.91 & 0.00 \\ 
  age & -0.09 & -6.50 & 0.00 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}
Run Code Online (Sandbox Code Playgroud)