Re: [R] row.names need reordering

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
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,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
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