Peter Wilkinson
2004-Jun-22 19:24 UTC
[R] write.table when keeping column headers (names of Columns in matrix) and row numbers
When using the write.table (say for a tab delimited file) command on a matrix with Row and Columns, the column headers are always being left shifted into the column where the row numbers are being placed. One can see this when you open up the tab delimited file in excel. Is there a better command for this, or is this supposed to be a 'feature'. Peter
Prof Brian Ripley
2004-Jun-22 20:00 UTC
[R] write.table when keeping column headers (names of Columns in matrix) and row numbers
>From the details of ?write.table (and in the Data Import/Export manualand in MASS4 ...) 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. What can we possible do to make this more obvious? On Tue, 22 Jun 2004, Peter Wilkinson wrote:> When using the write.table (say for a tab delimited file) command on a > matrix with Row and Columns, the column headers are always being left > shifted into the column where the row numbers are being placed. One can see > this when you open up the tab delimited file in excel. > > Is there a better command for this, or is this supposed to be a 'feature'.It is a genuinely useful feature, fully documented. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595