[R] How to create a table with borders?

arun smartpink111 at yahoo.com
Tue Oct 9 14:31:38 CEST 2012


HI Rui,
Thanks for the alternate method.

I guess OP had trouble with pdflatex processing (output of latex(tab)) to create the table.
A.K.




----- Original Message -----
From: Rui Barradas <ruipbarradas at sapo.pt>
To: killerkarthick <karthick.gdi at gmail.com>
Cc: r-help at r-project.org
Sent: Tuesday, October 9, 2012 3:15 AM
Subject: Re: [R] How to create a table with borders?

Hello,

Why not use package xtable? I've just tried the following.

#install.packages('xtable')
library(xtable)

x <- 1:20
y <- 0.5*x + rnorm(20)

fit <- aov(y ~ x)
latex.tbl <- xtable(fit)
align(latex.tbl) <- "|lrrrrr|"
print(latex.tbl)

The output was

% latex table generated in R 2.15.1 by xtable 1.7-0 package
% Tue Oct 09 08:12:33 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{|lrrrrr|}
  \hline
& Df & Sum Sq & Mean Sq & F value & Pr($>$F) \\
  \hline
x & 1 & 191.80 & 191.80 & 208.27 & 0.0000 \\
  Residuals & 18 & 16.58 & 0.92 &  &  \\
   \hline
\end{tabular}
\end{center}
\end{table}


Hope this helps,

Rui Barradas


Em 09-10-2012 04:47, killerkarthick escreveu:
> Thanks arun,
>                     But what is the alternative solution in windows. Please
> reply me.................................
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-create-a-table-with-borders-tp4645470p4645527.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

______________________________________________
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.





More information about the R-help mailing list