Hello, All,
How can one sort on column and row names. For example:
How can this
X1 X3 X2
X1 1 0 0
X3 0 1 0
X2 0 0 1
become this?
X1 X2 X3
X1 1 0 0
X2 0 1 0
X3 0 0 1
Thank you for your time!
Jim
[[alternative
Jim -
I believe
dat[order(rownames(dat)),order(colnames(dat))]
is what you are looking for.
- Phil Spector
Statistical Computing Facility
Department of Statistics
Yes, that is it. Thank you very much, Phil.
-Original Message-
From: Phil Spector [mailto:spec...@stat.berkeley.edu]
Sent: Thursday, February 17, 2011 3:36 PM
To: Jim Moon
Cc: r-help@r-project.org
Subject: Re: [R] sort by column and row names
Jim -
I believe
dat[order(rownames
3 matches
Mail list logo