An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100701/772dc9bc/attachment.pl>
help with the xtable package
2 messages · Changbin Du, Erik Iverson
Changbin Du wrote:
HI, Dear R community, I am using the xtable to create the table, but how can I see the table? The following is the codes I used:
data(tli) tli.table <- xtable(tli[1:10, ]) digits(tli.table)[c(2, 6)] <- 0 print(tli.table, floating = FALSE)
% latex table generated in R 2.11.0 by xtable 1.5-6 package
% Thu Jul 1 20:43:43 2010
\begin{tabular}{rrlllr}
\hline
& grade & sex & disadvg & ethnicty & tlimth \\
\hline
1 & 6 & M & YES & HISPANIC & 43 \\
2 & 7 & M & NO & BLACK & 88 \\
3 & 5 & F & YES & HISPANIC & 34 \\
4 & 3 & M & YES & HISPANIC & 65 \\
5 & 8 & M & YES & WHITE & 75 \\
6 & 5 & M & NO & BLACK & 74 \\
7 & 8 & F & YES & HISPANIC & 72 \\
8 & 4 & M & YES & BLACK & 79 \\
9 & 6 & M & NO & WHITE & 88 \\
10 & 7 & M & YES & HISPANIC & 87 \\
\hline
\end{tabular}
You're trying to generate a LaTeX table, right? Hopefully, since this function is producing LaTeX code for you. You need to construct a wrapper LaTeX document that includes the code output. You can write the code generated to disk using the ?print.xtable function, and its file argument.