Skip to content
Back to formatted view

Raw Message

Message-ID: <25F43847-81F3-4231-8D4F-DE54B85E6084@gmail.com>
Date: 2011-12-06T09:18:05Z
From: Thomas Friedrichsmeier
Subject: Writing out in loops

I would like to write some data to different files. I can create the  
filename Day1.txt like this:

filen <- paste("Day", l, ".txt", sep="")

and then I'm using a For loop to write out one row of a matrix,  
something like this:

For (j in 1:10)
{
cat(mat[1,j], ",", file=filen, append=TRUE)
}
cat("\n", file=filen, append=TRUE)

but is there a better way to do this?

Thank you,

Thomas