Waichler, Scott R
2004-Mar-12 16:38 UTC
[R] Sweave and R output: possible to suppress "Schunk" tags in *.tex file output?
Hello, I would like to fill the rows of a Latex tabular environment with output from R, as in \begin{table} \caption{Table caption.} \label{tab:events} \begin{tabular}{c r r r r r} \hline <<echo=false,results=tex>>fill.my.table.rows() @ \end{tabular} \end{table} Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands, which latex doesn't tolerate within a table. I would prefer to avoid writing all of the Latex table code from R. Is my only other option to produce a separate text file, e.g. under Sweave with results=hide, then use \input{} on the file? Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov
Ole F. Christensen
2004-Mar-12 19:04 UTC
[R] Sweave and R output: possible to suppress "Schunk" tags in *.tex file output?
Dear Scott Why not use the function xtable() in the library of the same name for this ? Cheers Ole Hello, I would like to fill the rows of a Latex tabular environment with output from R, as in \begin{table} \caption{Table caption.} \label{tab:events} \begin{tabular}{c r r r r r} \hline <<echo=false,results=tex>>fill.my.table.rows() @ \end{tabular} \end{table} Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands, which latex doesn't tolerate within a table. I would prefer to avoid writing all of the Latex table code from R. Is my only other option to produce a separate text file, e.g. under Sweave with results=hide, then use \input{} on the file? Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov ------------------------------------------------------------------------ *
Friedrich.Leisch@ci.tuwien.ac.at
2004-Mar-15 09:11 UTC
[R] Sweave and R output: possible to suppress "Schunk" tags in *.tex file output?
>>>>> On Fri, 12 Mar 2004 08:38:53 -0800, >>>>> Waichler, Scott R (WSR) wrote:> Hello, > I would like to fill the rows of a Latex tabular environment with output from > R, as in > \begin{table} > \caption{Table caption.} > \label{tab:events} > \begin{tabular}{c r r r r r} > \hline > <<echo=false,results=tex>> > fill.my.table.rows() > @ > \end{tabular} > \end{table} > Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands, > which latex doesn't tolerate within a table. I would prefer to avoid writing all of > the Latex table code from R. Is my only other option to produce a separate > text file, e.g. under Sweave with results=hide, then use \input{} on the file? results=tex will do what you want, i.e., produce no Soutput and Schunk environments. you may also want to look at package xtable. best, -- ------------------------------------------------------------------- Friedrich Leisch Institut f?r Statistik Tel: (+43 1) 58801 10715 Technische Universit?t Wien Fax: (+43 1) 58801 10798 Wiedner Hauptstra?e 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
Friedrich.Leisch@ci.tuwien.ac.at
2004-Mar-16 12:10 UTC
[R] Sweave and R output: possible to suppress "Schunk" tags in *.tex file output?
>>>>> On Fri, 12 Mar 2004 08:38:53 -0800, >>>>> Waichler, Scott R (WSR) wrote:> Hello, > I would like to fill the rows of a Latex tabular environment with output from > R, as in > \begin{table} > \caption{Table caption.} > \label{tab:events} > \begin{tabular}{c r r r r r} > \hline > <<echo=false,results=tex>> > fill.my.table.rows() > @ > \end{tabular} > \end{table} > Sweave produces the output inside \begin{Schunk} and \end{Schunk} commands, > which latex doesn't tolerate within a table. I would prefer to avoid writing all of > the Latex table code from R. Is my only other option to produce a separate > text file, e.g. under Sweave with results=hide, then use \input{} > on the file? Oops, that's a bug in Sweave ... the Schunk shouldn't be there in that case. I will fix it for 1.9.0. Best, -- ------------------------------------------------------------------- Friedrich Leisch Institut f?r Statistik Tel: (+43 1) 58801 10715 Technische Universit?t Wien Fax: (+43 1) 58801 10798 Wiedner Hauptstra?e 8-10/1071 Friedrich.Leisch at ci.tuwien.ac.at A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch
Jason Turner
2004-Mar-16 21:16 UTC
[R] Sweave and R output: possible to suppress "Schunk" tags in *.tex file output?
Friedrich.Leisch at ci.tuwien.ac.at wrote:> results=tex will do what you want, i.e., produce no Soutput and Schunk > environments. you may also want to look at package xtable.Just to add, the function latex() in the Hmisc package is also quite good. Cheers Jason