[R] Sweave and xtable floating issues -- SOLVED

Liviu Andronic landronimirc at gmail.com
Fri Jun 19 18:59:02 CEST 2009


Dear all,
I've recently made in LyX a report using Sweave and run into troubles
with xtable() generated LaTeX tables. One example, xtable() commands
inside floats (table, box (minipage), etc.) will make the LaTeX
compilation fail. Another, if four-five xtable() commands are run in a
sequence, at least one of the generated tables will strangely hop onto
the next page.

The culprit is that print.xtable() defaults to floating=TRUE, which
means that each xtable() generated table will be a float. To work
around any such issues instead of
> xtable(as.matrix(mean(c(1:10))))

simply issue
> print(xtable(as.matrix(mean(c(1:10)))), floating=F)

If you do so, you might also want to center the command in LaTeX (as
xtable() no longer does this). Hope this is of help,
Liviu



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail




More information about the R-help mailing list