[R] swapping rows with columns
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Mar 12 17:25:47 CET 2002
Arne Mueller wrote:
>
> Hello,
>
> 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"
> "S..cerevisiae"
> [5] "E..coli" "M..tuberculosis" "B..subtilis"
> "V..cholerae"
> [9] "A..pernix" "P..horikoshii" "M..jannaschii"
> "A..aeolicus"
> [13] "H..pylori" "M..genitalium"
>
> Do I have to recunstruct the new frame or matrix manually?
t(x)
Uwe
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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