Re: [R] appending collums in for loop

From: Who Am I? <>
Date: Tue, 22 Mar 2011 07:56:04 -0700 (PDT)

Got it working with a package called 'xlsReadWritePro' (which requires a license after 30 day's...) This is my code: setwd("J:/Stage/Datasets2/Datasets/outData")

_SNP_IDs.xls",sep="\t", dec=",", fill=T, header=T)

fileNames<-list.files(getwd(), pattern='_0,5 -0,51.xls') library(xlsReadWritePro)
write.xls(regionMatchM, file= "Array012345.xls") for(i in 1:5) {

                fileName <- fileNames[i]
    newFile <- file.path(getwd(), paste(fileNames[i], "samen_0,5 -0,51.xls"))

                snpidFile<-read.table(fileNames[i],sep="\t", dec=",", fill=T, header=T)     snpidFile<-data.frame(snpidFile)

                regionMatch<-cbind(masterTable, snpidFile[match(masterTable$Pos, snpidFile$Pos),])

    regionMatchABCDE<-data.frame(regionMatch[10:18])     write.xls(regionMatchABCDE, file= "Array012345.xls", naStrings = "NAN", append=T, from= c(1,(1+i)*9), rowNames=FALSE) }
finalTable<-data.frame(masterTable, genomeInfo[,18:len]) summary(finalTable)
write.table(finalTable, file= "Array012345_final1.xls", append=F, col.names=T, row.names=F, quote=F, sep = "\t")

Thanks for the help anyway. If someone has a solution for this problem, without the need of a package, please reply

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Tue 22 Mar 2011 - 15:25:52 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 Tue 22 Mar 2011 - 15:40:24 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive