Re: [R] using latex() in R for Unix

From: Richard M. Heiberger <rmh_at_temple.edu>
Date: Sat 06 May 2006 - 00:48:06 EST


The difficulty you are running into is related to the fact that print methods return their argument as their value. They do not return a representation of the text that appears on the screen. At some level, it looks like the intent is to capture the screen text and reformat it for LaTeX. This is not easily done without getting inside the print method.

You can get an effect close to what you want with the single statement   tmp <- latex(list(Estimates, sumStat)) ## assignment prevents automatic printing but it will still produce two table environments, one for each component of the list.

The result you are looking for is not a simple rectangular array. We have zillions of arguments in latex() for controlling the appearance of rectangular arrays. The types of controls that are needed for more general structures are more general and we don't have all that you would want. You might want to look at the insert.bottom argument and the caption and caption.loc arguments.

For full control, you have the choice of doing formatting on the R side or on the LaTeX side. You can write
  sumStat <- paste("\multicolumn{3}{l}{", "N= ",sum(sumobj$df[-1]), ", R^2 =",

                   sumobj$r.squared, ", RMSE = ", sumobj$sigma, "}")
on the R side. Or you can edit the latex file to add the \multicolumn. Since you will need to edit the latex anyway to move the line from its own table to the bottom of the first table, I think it would be easier to do everything on the LaTeX side.

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat May 06 00:53:18 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 06 May 2006 - 02:09:59 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.