[R] How to combine and transpose lists

arun smartpink111 at yahoo.com
Wed Jun 19 15:40:33 CEST 2013


Hi,
Please use ?dput(). 

 If `lst1` is the list.


do.call(rbind,lapply(lst1,t))
#          Estimate  Std. Error   t value   Pr(>|t|)
#card1  0.000577912 0.003956905 0.1460515 0.88388493
#card2  0.005164347 0.003311546 1.5594972 0.11892405
#card3  0.002682773 0.003683422 0.7283372 0.46643165
#cardva 0.003123452 0.002727940 1.1449856 0.25225436
#resp1  0.005552192 0.007135446 0.7781142 0.43652806
#resp2  0.010337814 0.004848899 2.1319923 0.03304227
#resp3  0.002850401 0.006422570 0.4438100 0.65719368
#respir 0.006212050 0.004121313 1.5072989 0.13177931


A.K.


I have lists that look like the following: 

[[1]] 

                      card1     card2     card3      cardva 
Estimate   0.000577912 0.005164347 0.002682773 0.003123452 
Std. Error 0.003956905 0.003311546 0.003683422 0.002727940 
t value    0.146051523 1.559497247 0.728337154 1.144985607 
Pr(>|t|)   0.883884930 0.118924052 0.466431647 0.252254365 

[[2]] 
                      resp1     resp2     resp3      respir 
Estimate   0.005552192 0.010337814 0.002850401 0.006212050 
Std. Error 0.007135446 0.004848899 0.006422570 0.004121313 
t value    0.778114195 2.131992269 0.443810047 1.507298878 
Pr(>|t|)   0.436528058 0.033042268 0.657193676 0.131779306 


My aim is to combine the lists and transpose them.  The 
final output is to have effect estimates with corresponding std error 
and p values as column headers and card1,  card2 , etc... as rows. How 
can I do that? 

Thanks in advance



More information about the R-help mailing list