[R] print of objects in R
andrew
andrewjohnroyal at gmail.com
Fri Mar 20 03:51:29 CET 2009
xtable in the library xtable does a good job if you are using latex to
write up your results. For example:
> xtable(matrix(rnorm(20),5,5))
% latex table generated in R 2.8.0 by xtable 1.5-4 package
% Fri Mar 20 13:48:53 2009
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrrr}
\hline
& 1 & 2 & 3 & 4 & 5 \\
\hline
1 & -0.45 & 0.25 & -0.42 & -1.64 & -0.45 \\
2 & 1.39 & 0.06 & 0.08 & 2.12 & 1.39 \\
3 & 0.49 & -0.78 & -1.28 & -0.45 & 0.49 \\
4 & -0.11 & -0.81 & 1.48 & 0.30 & -0.11 \\
5 & 0.12 & -0.11 & -0.14 & 1.50 & 0.12 \\
\hline
\end{tabular}
\end{center}
\end{table}
Or you could roll your own using for loops and the print function if
this format isn't what you want.
HTH,
Andrew.
On Mar 20, 12:48 pm, "Mary A. Marion" <mms... at comcast.net> wrote:
> Hello,
>
> I have been watching my output as I create functions and do other things
> in r.
> One thing I don't like is the [1,] type notation at the beginning of a
> line. I have been
> able to change that to a number such as 1 2 etc. using
> as.data.frame(object).
>
> How can I stop the printing of a line number and column heading if I
> want to?
> I am thinking about publishing and writing of papers. It is much easier
> to not have to
> remove that leading line number when inserting output into papers.
>
> Thank you.
>
> Sincerely,
> mmstat
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list