You can use xtable() or latex() and then edit the columns names in the
generated .tex file.  That is a much better plan than reinventing either of
those functions.

On Thu, Mar 22, 2012 at 3:46 AM, Manish Gupta <mandecent.gu...@gmail.com>wrote:

> Hi,
>
> I am working on table suing R and Latex.  I am writing .Rnw file first in
> which i m reading input file and storing into dataframe. After filtering
> certain values from this dataframe. I am planning to display it. I don't
> want to use xtable since i need to change column names.
>
> *Sample .Rnw file*
>
> @
> <<echo=FALSE>>=
> cat("\begin{table}[ht]")
> cat("\begin{center}")
> cat("\begin{tabular}{lrrrrr}")
> cat  ("\hline")
> cat ("& Df & Sum Sq & Mean Sq & F value & Pr($>$F) \\")
> cat  ("\hline")
> cat("block       & 5 & 343.29 & 68.66 & 4.45 & 0.0159 \\")
> cat  ("N           & 1 & 189.28 & 189.28 & 12.26 & 0.0044 \\")
> cat  ("P           & 1 & 8.40 & 8.40 & 0.54 & 0.4749 \\")
> cat  ("K           & 1 & 95.20 & 95.20 & 6.17 & 0.0288 \\")
> cat  ("N:P         & 1 & 21.28 & 21.28 & 1.38 & 0.2632 \\")
> cat  ("N:K         & 1 & 33.13 & 33.13 & 2.15 & 0.1686 \\")
> cat  ("P:K         & 1 & 0.48 & 0.48 & 0.03 & 0.8628 \\")
> cat  ("Residuals   & 12 & 185.29 & 15.44 &  &  \\")
> cat   ("\hline")
> cat("\end{tabular}")
> cat("\end{center}")
> cat("\end{table}")
> @
>
> But i am getting error  cat("\" not supported.  In my case tabular values
> are variable. How can i fix my pblm?
>
> Regards
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-draw-table-in-Latex-without-using-xtable-tp4494781p4494781.html
> Sent from the R help mailing list archive at Nabble.com.
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to