Hi Elio,
Try this:
library(stringr)
 lines1<-str_trim(gsub("\t"," ",readLines("elio.txt")))
 lst1<-lapply(split(lines1,cumsum(lines2=="")),function(x) x[x!=""])

lst2<- lapply(lst1[lapply(lst1,length)>0],function(x) 
as.matrix(read.table(text=x,row.names=1)))
names(lst2)<- paste0("m",seq_along(lst2))

lst2[1:2]
#$m1
 #    aa5 aa10 b253 b254
#aa5    0    1    1    1
#aa10   1    0    1    1
#b253   1    1    0    1
#b254   1    1    1    0
#
#$m2
 #   aa5 aa9 b27 b29
#aa5   0   1   1   1
#aa9   1   0   1   1
#b27   1   1   0   1
#b29   1   1   1   0


A.K.

________________________________
From: Elio Shijaku <sel...@gmail.com>
To: arun <smartpink...@yahoo.com> 
Sent: Thursday, September 19, 2013 3:27 AM
Subject: Re: binary symmetric matrix combination



Hi Arun,

Please find attached the text file. Let me know if anything else is needed. 
Thanks a lot for your continuous help.

Best,

Elio

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to