[R] weird merge()

array chip arrayprofile at yahoo.com
Fri Jan 11 19:50:02 CET 2013


Hi,

I have some protein array data, each array in a separate text file. So I read them in and try to combine them into a single data frame by using merge(). see code below (If you download the attached data files into a specific folder, the code below should work):


fls<-list.files("C:\\folder_of_download",full.names=T) ## get file names
prot<-list() ## a list to contain individual files
ind<-1
for (i in fls[c(1:11)]) {
    cat(ind, " ")
    
    tmp<-read.delim(i,header=T,row.names=NULL,na.string='null')
    colnames(tmp)[4]<-as.character(tmp$barcode[1])
    prot[[ind]]<-tmp[,-(1:2)]
    ind<-ind+1
}

        ## try to merge them together
        ## not do this in a loop so I can see where the problem occurs
pro<-merge(prot[[1]],prot[[2]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[3]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[4]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[5]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[6]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[7]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[8]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[9]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[10]],by.x=1,by.y=1,all=T)
pro<-merge(pro,prot[[11]],by.x=1,by.y=1,all=T)


I noticed that starting file #8, the merge become more and more slower that when it's file #11, the computer was stuck!  Originally I thought something wrong with the later files, but when I change the order of merging, the slow-down still happens at the 8th files to be merged.

Can anyone suggest what's going on with merging?

Thanks

John
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p1.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0022.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p2.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0023.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p3.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0024.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p4.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0025.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p5.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0026.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p6.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0027.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p7.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0028.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p8.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0029.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p9.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0030.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p10.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0031.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p11.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130111/7f91db84/attachment-0032.txt>


More information about the R-help mailing list