Try this: X<-c("A","B","C","D","E") Y<-c(0,1,2,3,4) for (i in 0:3) { Y<-Y+i data<-data.frame(X,Y) fe.flag <- file.exists("test.csv") write.table(data, "test.csv", row.names = FALSE, col.names = !fe.flag, sep=";", append = fe.flag) } [[alternative HTML version deleted]]