2

I am using sweave in R-Studio and am attempting to use the R package apsrtable. Both the model objects I am passing apsrtable are lm objects, and I get the error

illegal character in array arg

when I run sweave.

\documentclass{article}
\usepackage{fullpage}
\begin{document}

<<results=tex>>=
apsrtable(mod.um,mod.km, Sweave=TRUE)
@

Here is the LaTeX code apsrtable generates

\begin{tabular}{ l D{.}{.}{2}D{.}{.}{2} }
\hline
            & \multicolumn{ 1 }{ c }{ Model 1 } & \multicolumn{ 1 }{ c }{ Model 2 } \\ \hline
%           & Model 1 & Model 2\\ 
(Intercept) & -0.06   & -0.05  \\ 
            & (0.12)  & (0.12) \\ 
lag1.x      & 3.28 ^* & 0.25   \\
            & (0.42)  & (0.67) \\ 
lag2.x      & 2.31 ^* &        \\ 
            & (0.42)  &        \\ 
lag3.x      & 0.86 ^* &        \\ 
            & (0.42)  &        \\ 
lag4.x      & 0.77    &        \\ 
            & (0.42)  &        \\ 
lag5.x      & 1.60 ^* &        \\ 
            & (0.42)  &        \\ 
lag.y       &         & 0.62 ^*\\ 
            &         & (0.10) \\
$N$         & 145     & 149    \\ 
$R^2$       & 0.47    & 0.42   \\ 
adj. $R^2$  & 0.45    & 0.41   \\ 
Resid. sd   & 1.44    & 1.49   \\ \hline
\multicolumn{3}{l}{\footnotesize{Standard errors in parentheses}}\\
\multicolumn{3}{l}{\footnotesize{$^*$ indicates significance at $p< 0.05 $}}
\end{tabular}
\end{document}
4
  • Hint: Use back ticks for inline code, and indent four spaces for blocks. It's also better to include a minimal working example.
    – qubyte
    Mar 20, 2012 at 17:36
  • Thanks, for some reason I can't indent in any of the stackexchange forms. Idk why. It just switches fields. I will add my other settings to make this hopefully reproducible. Thanks.
    – Zach
    Mar 20, 2012 at 17:40
  • 1
    @Zach Don't use the tab key. Just indent your code by four spaces. If you do so it will not switch the fields.
    – Thorsten
    Mar 20, 2012 at 17:47
  • @Zach: There's also the {} button in the editor that does both inline and block code for you. Select the code and click the button to use it.
    – qubyte
    Mar 20, 2012 at 17:51

1 Answer 1

3

insert into the preamble:

\usepackage{dcolumn}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .