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]]


