Hello.

I'm using lyx with the knitr (to comunicate with R language) module to write my analysis report, and I have a problem with dcolumn packages


Example without lyx (it works)
Using gedit or Rstudio, and compile using Knitr package in R language.

\documentclass{article}
\usepackage{booktabs}
\usepackage{dcolumn}
\begin{document}

<<>>=
library(memisc)

X1 <- rnorm(1000)
X2 <- rnorm(1000)
X3 <- rnorm(1000)
X4 <- rnorm(1000)

#Create a relationship to Model:
Y <- X1 + 1.8*X2 -.12*X3 + 1.8*X4 + rnorm(1000)
Model.1 <- lm(Y ~ X1 + X2)
Model.2 <- lm(Y ~ X1 + X3)
Model.3 <- lm(Y ~ X1 + X2 + X3)
Model.4 <- lm(Y ~ X1 + X2 + X3 + X4)

tabla <- mtable(Model.1,Model.2,Model.3,Model.4)
@

<<results='asis'>>=
toLatex(tabla)
@

\end{document}

In my lyx document I write in preamble
\usepackage{booktabs}
\usepackage{dcolumn}

And the next of document is similar, with the "chunks" <<>>= @ into a TEX box.

I think what the problem is in dcolumn package because when I write

<<results='asis'>>=
toLatex(tabla,useDcolumn=FALSE)
@

PDF is compiled but I don't get decimal-alignment.

Any idea?

Thanks.

Reply via email to