[R] add a list name into the list content in a new output

Shuhua Zhan szhan at uoguelph.ca
Mon Jan 19 21:14:47 CET 2015


Dear All,
I'd like to add a list name into the list contents to make a new output. The list is a list of data.frame derived from summary command in Rqtl. I want to add this list name to the data frame with a given column name such as "trait" and output this entire list as a table tab delimited as below.
Here is the list generated by summary command in Rqtl:
> summary(out.all, threshold=3, format="tabByCol")
bp:
         chr  pos ci.low ci.high  lod
c7.loc45   7 47.7  36.71    56.7 6.11
c15.loc8  15 12.0   3.96    22.8 5.29

hr:
          chr  pos ci.low ci.high  lod
c2.loc54    2 59.8   14.8    87.8 4.19
D15MIT184  15 22.8   12.0    36.0 3.15

bw:
          chr pos ci.low ci.high  lod
c15.loc16  15  20     11      30 6.75

heart_wt:
          chr  pos ci.low ci.high  lod
c12.loc49  12 51.2   28.2    62.2 3.65


The new output I want:

trait locus  chr  pos ci.low ci.high  lod
bp c7.loc45   7 47.7  36.71    56.7 6.11
bp c15.loc8  15 12.0   3.96    22.8 5.29

trait locus  chr  pos ci.low ci.high  lod
hr c2.loc54    2 59.8   14.8    87.8 4.19
hr D15MIT184  15 22.8   12.0    36.0 3.15

trait locus chr pos ci.low ci.high  lod
bw c15.loc16  15  20     11      30 6.75

heart_wt locus chr  pos ci.low ci.high  lod
trait c12.loc49  12 51.2   28.2    62.2 3.65

I appreciate for your help for any suggestions!!
Joshua



More information about the R-help mailing list