[R] question about 'write.table'

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Wed May 5 14:17:05 CEST 2010


This could work

out <- c()
for (a in 1:10){
out[a] <- paste("loci",a,sep="") 
write.table(out[a],file=out[a],row.names=FALSE,col.names=FALSE)}


Muhammad 




karena wrote:
> I have a question about the "write.table"
>
> I have 100 data.frames, loci1, loci2, loci3.............,loci100. 
> now, I want to print these data.frames to 100 separate files, and the names
> of the files are also loci1, loci2, loci3,......., loci100.
>
> how to perform this under a "for" loop?
> say,
> for (i in 1:100) {
>    write.table(...., file='...', ........)
> }
>
> thank you,
>
> karena
>
>
>



More information about the R-help mailing list