[R] Maintaining sort order when transpose

2009-10-01 Thread Dry, Jonathan R
Hi all - I have a data frame and have sorted it by a particular column, with 
rownames set to a different variable.  I wish to transpose this data frame, 
naming columns by the rowname variable but maintaining the sorted order through 
to the order of columns in my transposed table, however use of  t(DF) results 
in a transposed table where the columns are ordered alphabetically by the 
original rownames.  Any ideas how I can get around this?

--
AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Maintaining sort order when transpose

2009-10-01 Thread Kevin Wright
An example would be helpful, but if I understand correctly, can't you do
something like

TDF=t(DF)
TDF=TDF[,rownames(DF)]

Kevin Wright


On Thu, Oct 1, 2009 at 9:04 AM, Dry, Jonathan R 
jonathan@astrazeneca.com wrote:

 Hi all - I have a data frame and have sorted it by a particular column,
 with rownames set to a different variable.  I wish to transpose this data
 frame, naming columns by the rowname variable but maintaining the sorted
 order through to the order of columns in my transposed table, however use of
  t(DF) results in a transposed table where the columns are ordered
 alphabetically by the original rownames.  Any ideas how I can get around
 this?

 --
 AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}}

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.