[R] sweave xtable and driver RweaveHTML

Yihui Xie xie at yihui.name
Thu Nov 8 18:10:20 CET 2012


You can certainly generate an HTML table, but how about the rest of
your Snw document? How are you going to convert them to HTML? I mean
otherwise you get something like this which is not a valid HTML
document:

\documentclass{article}
\begin{document}
<TABLE border=1>
<TR> <TH>  </TH> <TH> Sepal.Length </TH> <TH> Sepal.Width </TH> <TH>
Petal.Length </TH> <TH> Petal.Width </TH> <TH> Species </TH>  </TR>
  <TR> <TD align="right"> 1 </TD> <TD align="right"> 5.10 </TD> <TD
align="right"> 3.50 </TD> <TD align="right"> 1.40 </TD> <TD
align="right"> 0.20 </TD> <TD> setosa </TD> </TR>
  <TR> <TD align="right"> 2 </TD> <TD align="right"> 4.90 </TD> <TD
align="right"> 3.00 </TD> <TD align="right"> 1.40 </TD> <TD
align="right"> 0.20 </TD> <TD> setosa </TD> </TR>
   </TABLE>
\end{document}


It is not easy to write a document for both LaTeX and HTML, although
the R output can be easily converted to either LaTeX or HTML.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Thu, Nov 8, 2012 at 4:29 AM, Witold E Wolski <wewolski at gmail.com> wrote:
> Hi,
>
> So far I used Sweave to create pdf reports. I used xtable to create some
> tables in the report.
>
> But now I would like to use the same snw file to generate an HTML version.
> The xtable output breaks the RweaveHTML driver.
> library(R2HTML)
> Sweave('analyseLFQ.Snw', driver = RweaveHTML)
>
> Error in match.arg(options$results, c("Robj", "html", "hide")) :
>   'arg' should be one of “Robj”, “html”, “hide”
>
> Any suggestions would be highly recommended. I.e. I am wondering can I
> include dynamically generated tables in Sweave output,
> using syntax independent of the renderer?
>
>
> regards
> Witold
>
>
>
>
> --
> Witold Eryk Wolski
>
> Triemlistrasse 155
> 8047 Zuerich
>




More information about the R-help mailing list