Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.61.0505160705080.20582@gannet.stats>
Date: 2005-05-16T06:07:29Z
From: Brian Ripley
Subject: row.names need reordering
In-Reply-To: <Pine.LNX.4.58.0505160042070.4073@ls01.fas.harvard.edu>

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 at 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