Re: [R] row.names need reordering

From: Prof Brian Ripley <>
Date: Mon 16 May 2005 - 16:07:29 EST

On Mon, 16 May 2005, Anders Schwartz Corr wrote:

> The row.names in my matrix seem to be out of order. I don't remember
> putting row.names in in the first place, I don't see what use they are,
> and they are out of order (perhaps because I sorted them at one point when
> the data was in data.frame format). Can I delete the rownames? or at least
> just reorder them in proper order? I know how to delete them -- how do I
> reorder them sequentially?

Matrices strictly have rownames, data frames row.names. So try

rownames(A) <- seq(len=nrow(A))

(to delete them, use NULL as the rhs).

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Mon May 16 16:16:47 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST