I have a loop for a data frame construction, and I would like to write all small pieces at each iteration in a csv file. Something like a rbind()
but in a file...
I have seen sink() like that
exemple :
sink("resultat/output.txt")
df.total<-NULL
for(i in 1:length(list2.1)){
if(i%%100==0){print(i)}
tps<-as.data.frame(list2.1[i])
tps<-cbind(tps,as.data.frame(list2.2[i]))
colnames(tps)<-c("slope","echange")
tps$Run<-rep(data$run_nb[i],length(tps$slope))
tps$coefSlope<-rep(data$coef_Slope_i[i],length(tps$slope))
tps$coefDist<-rep(data$coef_dist_i[i],length(tps$slope))
sink(tps)
df.total<-rbind(df.total,tps)
}
sink()
write.csv(df.total,"resultat/df_total.csv")
but I don't think it work for my case ... any suggestions