From w.huber at dkfz.de  Thu Mar  6 18:41:49 2003
From: w.huber at dkfz.de (w.huber@dkfz.de)
Date: Thu Mar  6 18:42:05 2003
Subject: [Rd] write.table row.names and col.names (PR#2611)
Message-ID: <200303061741.h26Hfnn9029115@pubhealth.ku.dk>

Full_Name: Wolfgang Huber
Version: 1.6.2
OS: DEC OSF, Win, Linux
Submission from: (NULL) (155.52.45.139)


When data.frames are written to a file using write.table and with row.names and
col.names, then the colnames are displaced by 1 with respect to column content.
Example:


> x = data.frame(
>   obscht=c("chriesi", "bire"),
>     gmues=c("chrut","hoerdoepfl"))
> rownames(x) = c("huet", "morn")
> write.table(x, file="test.txt", sep="\t", quote=F)

The table x now looks like:
> x
      obscht      gmues
huet chriesi      chrut
morn    bire hoerdoepfl

but the file is as follows, and the column names will be confused when reading
this file e.g. from Excel.

obscht	gmues
huet	chriesi	chrut
morn	bire	hoerdoepfl


[Rd] write.table row.names and col.names (PR#2611)
w.huber@dkfz.de