0

I have already done most of my final paper using normal LaTeX and inserted a table using pgfsplotstable. However, I find it particularly difficult to edit/ style the table using this packages syntax.

So question is, can I genereate the table from Sweave and insert into my Tex file somehow, not as an image either.

sachinruk
  • 427

1 Answers1

1

A simple example:

test.Rnw:

\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
See table \ref{test}
<<test,echo=F,results=tex>>=
library(xtable)
a <- c(1.2,2.33,3.556)
b <- c(4.001,5.23,6.8)
c <- c(7,8,9.123) 
abc=data.frame(a=a,b=b,c=c)
xtable(abc, caption="A table example", label="test")
@
\end{document}

Compile this with

R CMD Sweave test.Rnw 
pdflatex test.tex
pdflatex test.tex    

The result must be:

MWE

Fran
  • 80,769