Re: [R] appending collums in for loop

From: Who Am I? <s1008701_at_student.hsleiden.nl>
Date: Mon, 21 Mar 2011 05:56:06 -0700 (PDT)

I forgot to say I need it to work in a for loop because it will be used for over 35 files. I previously programmed it in the most unorthodox way possible:

setwd("J:/Stage/Datasets2/Datasets/outData")

data1<-read.table("AR1000900A_N_241110_(Mapping250K_Nsp)_2,Mapping250K_Nsp,CNprobes.tab

_SNP_IDs.xls",sep="\t", dec=",", fill=T, header=T)
bukuA<-read.table("AR1000900A_N_241110_(Mapping250K_Nsp)_2,Mapping250K_Nsp,CNprobes.tab
_SNP_IDs.xls _0,5 -0,51.xls", sep="\t", dec=",", fill=T, header=T)
bukuB<-read.table("AR1000901A_N_241110_(Mapping250K_Nsp),Mapping250K_Nsp,CNprobes.tab
_SNP_IDs.xls _0,5 -0,51.xls", sep="\t", dec=",", fill=T, header=T)
bukuC<-read.table("AR1000902A_N_241110_(Mapping250K_Nsp),Mapping250K_Nsp,CNprobes.tab
_SNP_IDs.xls _0,5 -0,51.xls", sep="\t", dec=",", fill=T, header=T)
bukuD<-read.table("AR1000903A_N_291110_(Mapping250K_Nsp),Mapping250K_Nsp,CNprobes.tab
_SNP_IDs.xls _0,5 -0,51.xls", sep="\t", dec=",", fill=T, header=T)
bukuE<-read.table("AR1000904A_N_241110_(Mapping250K_Nsp),Mapping250K_Nsp,CNprobes.tab
_SNP_IDs.xls _0,5 -0,51.xls", sep="\t", dec=",", fill=T, header=T)
bukuA<-data.frame(bukuA)
bukuB<-data.frame(bukuB)
bukuC<-data.frame(bukuC)
bukuD<-data.frame(bukuD)
bukuE<-data.frame(bukuE)
regionMatchA<-cbind(data1, bukuA[match(data1$Pos, bukuA$Pos),])
regionMatchB<-cbind(data1, bukuB[match(data1$Pos, bukuB$Pos),])
regionMatchC<-cbind(data1, bukuC[match(data1$Pos, bukuC$Pos),])
regionMatchD<-cbind(data1, bukuD[match(data1$Pos, bukuD$Pos),]) regionMatchE<-cbind(data1, bukuE[match(data1$Pos, bukuE$Pos),])

regionMatchABCDE<-cbind(data1[,7],data1[,3],

regionMatchA[,10:18],regionMatchB[,10:18],regionMatchC[,10:18],regionMatchD[,10:18],regionMatchE[,10:18])
write.table(regionMatchABCDE, file= "Array0-1-2-3-4-5_0,5 -0,5.xls",
append=F, col.names=T, row.names=F, quote=F, sep = "\t", dec=",")


--
View this message in context: http://r.789695.n4.nabble.com/appending-collums-in-for-loop-tp3393446p3393481.html
Sent from the R help mailing list archive at Nabble.com.


______________________________________________
R-help_at_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.
Received on Mon 21 Mar 2011 - 13:53:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Mar 2011 - 14:40:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive