Re: [R] swutching rows to columns

2010-03-22 Thread Ista Zahn
Hi JR, t(EmpCo) gives what you want. See ?t for details. You can also do this with reshape: library(reshape) EmpCo$Label <- rownames(EmpCo) recast(EmpCo, variable ~ Label, measure.var=c("TRN", "TRN_CLUST")) but in this case t() seems a bit quicker and easier. -Ista On Mon, Mar 22, 2010 at 6:

[R] swutching rows to columns

2010-03-22 Thread LCOG1
Hi All, Consider the following: TRN<-c(5.809657,3.1, 1.774901e-02) TRN_CLUST<-c(-4.174682e-05, 5.538742e-05,1.2) EmpCo<-data.frame(TRN,TRN_CLUST) row.names(EmpCo)<-c("Slope","Fwy","Univ") returns: TRN TRN_CLUST Slope 5.80965700 -4.174682e-05 Fwy 3.1000 5.538742e-05 Un