Yuchen Luo
2007-Jun-22 03:09 UTC
[R] set up a talbe with column name and write to the table row by row
Dear Friends. I tried to set up a table with column name and write to it row by row. I have 3 rows to write to the table: a1 <- list(name="Fred", wife="Mary", no.children=3) a2 <- list(name="Tom", wife="Joy", no.children=9) a3 <- list(name="Paul", wife="Alic", no.children=5) When I write to it, the first write command has to be different than others in order to put the column name in the table: write.table(a1, file = "tt.csv", sep=',',row.names=FALSE,col.name=TRUE) write.table(a2, file="tt.csv", sep=',', append=TRUE, row.names=FALSE, col.names=FALSE) write.table(a3, file="tt.csv", sep=',', append=TRUE, row.names=FALSE, col.names=FALSE) Is there a way to seperate the operation of 1.putting the column name in the table and 2. writing the first row to the table ? Best Wishes Yuchen> >[[alternative HTML version deleted]]