[R] swapping rows with columns

Arne Mueller a.mueller at icrf.icnet.uk
Tue Mar 12 16:41:29 CET 2002


I've read in a data file as a frame and now I'd like the columns to be
rows and the rows to be columns. What's the easiest way to do this in R?

> class(d)
[1] "data.frame"

> rownames(d)
[1] "98x101" "40x98"  "30x40"  "0x30"  

> colnames(d)
 [1] "H..sapiens"      "C..elegans"      "D..melanogaster"
 [5] "E..coli"         "M..tuberculosis" "B..subtilis"    
 [9] "A..pernix"       "P..horikoshii"   "M..jannaschii"  
[13] "H..pylori"       "M..genitalium"  

Do I have to recunstruct the new frame or matrix manually?

	thanks for help,


Arne Mueller
Biomolecular Modelling Laboratory
Imperial Cancer Research Fund
44 Lincoln's Inn Fields
London WC2A 3PX, U.K.
phone : +44-(0)207 2693405      | fax :+44-(0)207-269-3534
email : a.mueller at icrf.icnet.uk | http://www.bmm.icnet.uk
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list