Skip to content

header line generated write.table

2 messages · Y C Tao, Marc Schwartz

#
On Wed, 2004-08-18 at 16:42, Y C Tao wrote:
The solution is on the help page for ?write.table:

Details

Normally there is no column name for a column of row names. If
col.names=NA a blank column name is added. This can be used to write CSV
files for input to spreadsheets.


Also, the first example on that page gives you:

## To write a CSV file for input to Excel one might use
write.table(x, file = "foo.csv", sep = ",", col.names = NA)


Thus:
"","Col1","Col2","Col3"
"Row1",1,1,1
"Row2",2,2,2

HTH,

Marc Schwartz