Dear Carlos, Try this: # Working directory setwd("C:/")
# Generating 10 files sapply(1:10, function(x){ # Create X X= matrix(rnorm(100),ncol=10) # Write X write.table(X, paste('my_matrix_',x,'.dat',sep=""), quote=FALSE,sep='\t',col.names=FALSE,row.names=FALSE) } ) HTH, Jorge On Thu, Dec 11, 2008 at 6:20 PM, Carlos López <nato...@fisica.unam.mx>wrote: > Hello all :) > > I have a for loop where in each cycle I create certain matrix object, let´s > say, X, I would like to write it > so I use the write.table function but I would like to write as many > matrices as cycles, this is, I would like > to use a variable, let´s say y, that will be in the for, as in: for (y in > 1:100) > > and then when I write the matrix in a file I would like to produce files > with different names, for examen > > my_matrix_1.dat > > my_matrix_2.dat > > my_matrix_3.dat > . > . > . > my_matrix_100.dat > > > is there any way to do this with the write.table function? > > Thank you very much in advance > Carlos > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > ______________________________________________ > 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. > [[alternative HTML version deleted]]
______________________________________________ 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.