[R] swutching rows to columns

LCOG1 jroll at lcog.org
Mon Mar 22 23:37:24 CET 2010


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.10000000  5.538742e-05
Univ  0.01774901  1.200000e+00

Now my own data is actually first constructed into list form(see below) so
perhaps it would be easier to perform the rows to columns operation from
that.  

List form:
$TRN
       Slope            Fwy              UnivDist      
   5.80965700      3.10000000       0.01774901 

What i would like to do is switch the rows to columsn so that the above now
shows:

	          Slope 	Fwy	           Univ
TRN	          5.809657	3.1	        0.01774901
TRN_CLUST -4.17E-05	5.54E-05	1.20E+00


Tried some things from the reshape package but i dont think thats what i
want.  I will need to do this for more variables and initial columns than
shown here so if the process is automated or easily put into an
automated(loop) form that would be best.  Gracias

JR
-- 
View this message in context: http://n4.nabble.com/swutching-rows-to-columns-tp1678429p1678429.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list