I'm trying to write some R code that takes data from my (evolving) experiment, makes a summary statistics table, and inputs it into the .tex document that I'm writing. I want to avoid copy-pasting. I want to avoid sweave because I don't have the badwidth to learn it right now, and because my code is complicated and takes a long time to run.

What I want is a table like I can get with the `tables` package in R, exported to a text file that I can then import into the .tex document using the `\input{}` command. Here is some simple R code that doesn't work like I'd like it to:

```
1> fac = c(rep("a",10),rep("b",10),rep("c",10))
1> var = c(rnorm(10,mean=4,sd = 5),rnorm(10,mean=2,sd = 10),rnorm(10,mean=3,sd = 1))
1> d = data.frame(fac,var)
1> library(tables)
1> sumstats = with(d, tabular(var*(fac+1)~mean+sd))
1> latex(sumstats)
\begin{tabular}{llcc}
\hline
 & fac & mean & \multicolumn{1}{c}{sd} \\ 
\hline
var & a  & $-0.1415$ & $\phantom{0}7.241$ \\
 & b  & $\phantom{-}0.3324$ & $14.704$ \\
 & c  & $\phantom{-}3.1590$ & $\phantom{0}1.118$ \\
 & All  & $\phantom{-}1.1166$ & $\phantom{0}9.271$ \\
\hline 
\end{tabular}
1> write.table.tabular(latex(sumstats),file='sumstats.txt')
\begin{tabular}{llcc}
\hline
 & fac & mean & \multicolumn{1}{c}{sd} \\ 
\hline
var & a  & $-0.1415$ & $\phantom{0}7.241$ \\
 & b  & $\phantom{-}0.3324$ & $14.704$ \\
 & c  & $\phantom{-}3.1590$ & $\phantom{0}1.118$ \\
 & All  & $\phantom{-}1.1166$ & $\phantom{0}9.271$ \\
\hline 
\end{tabular}
1> read.table('sumstats.txt')
            V1
1 character(0)

```

Is there a way to get R to write a summary statistics table that had been formatted for latex, that avoids the need to dive into sweave?