I usually use the following code for writing the results in a file in c:\...
y=rnorm(1000)
x=rep(0,length(y))
df=data.frame(rep(0,length(y)) , rep(0,length(y)))
for(i in 1:1000){
x[i]=y[i]+1
df[i,]=c(i,x[i])
print(df[i,])
flush.console()
}
write.table(df,"C:/.../results.txt")
I sometime (in more complicated situations) have ERROR
in for loop, so in write.table we will have nothing.
My question is: How to write over df
line by line in "c:\..."
in this for
loop