[R] Suppressing observation numbers

Rolf Turner rolf at math.unb.ca
Wed Mar 2 23:30:21 CET 2005


Nam-Ky Nguyen wrote:

> Below is a part of the R output. Please consider the two lines:
> > data
> > model.matrix(m1)
> 
> Is there a way of suppressing the observation numbers 1, 2, ...27 in the
> output (I don't want these number to appear in the output)?

The (``relatively low level''?) function prmatrix() allows you to do
what you want:

	> prmatrix(model.matrix(m1),rowlab=rep("",27))

I have in the past suggested to the R Core Team that an argument be
added to print.matrix() and print.data.frame() to permit the
suppression of the printing of row names.  Something like
``print.row.names=TRUE''.  This would be easy to accomplish, since
print.matrix() and print.data.frame() simply call upon prmatrix().
However my suggestion has so far fallen upon deaf ears.

				cheers,

					Rolf Turner
					rolf at math.unb.ca




More information about the R-help mailing list