Stacey Burrows schreef:> I have a data.frame, data, with 30 factor variables. I would like to
tabulate the frequencies of each variable and output to a tex file using Sweave.
Here is my code chunk:
>
> <<label=tab, echo=FALSE, results=tex>>> library(xtable)
> for(j in 1:30){
> cap <- paste("Frequency counts for Q",j,".",
sep="")
> xtable(t(table(data[,j])),caption=cap)
> }
> @
>
> Unfortunately when I compile the rnw file using Sweave, the tex file
generated contains no tables. Is it not possible to use xtable within a loop
like this? When I pull it out of the loop, it works fine.
>
> Thanks for any help,
> Stacey
>
>
>
>
> __________________________________________________________________
> [[elided Yahoo spam]]
>
> [[alternative HTML version deleted]]
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Hi,
Try adding a print statement around the xtable command.
cheers,
Paul
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul