I want to write following data frame into a CSV file:
 
          Col1   Col2  Col3
Row1   1       1     1
Row2   2       2     2
 
where Row1, Row2 are the row names and Col1, Col2, Col3 are the column names.
 
The correct CSV file should be:
,"Col1","Col2","Col3"
Row1,1,1,1
Row2,2,2,2
 
However, the one generated by R using write.table(x, file="xyz.csv", sep=",") has a header line that reads:
"Col1","Col2","Col3"
without the comma at the very beginning.
 
As a result, if you open the file in Excel, the column names are not correct (shifted to the left by one column).
 
Is there a way to get around this?
 
Thanks!
 

		
---------------------------------


	[[alternative HTML version deleted]]


