[Rd] write.table confused by rownames/colnames (PR#7941)

rasche@molgen.mpg.de rasche at molgen.mpg.de
Wed Jun 15 15:11:07 CEST 2005


Hello,

Alright, I did not look at it that way I admit. I built a matrix with 
multiple row names (as a data.frame). Confusion started when exporting 
this as a spread-sheet.
Now it all works fine.

Thanks and sorry for the false alarm,
Axel

Prof Brian Ripley wrote:
> It seems that you are the one who is confused: the help file says
> 
>      By default there is no column name for a column of row names.  If
>      'col.names = NA' a blank column name is added.
> 
> If there are no row names, there is no point in adding a blank column 
> name for them.  So what did *you* think it would do?
> 
> On Wed, 15 Jun 2005 rasche at molgen.mpg.de wrote:
> 
>> Full_Name: Axel Rasche
>> Version: 2.1.0
>> OS: Win2000
>> Submission from: (NULL) (141.14.21.81)
>>
>>
>> write.table does not accept the second statement with
>>    <col.names = NA, row.names = FALSE>.
>> I do not see why this should not be possible.
>>
>> test = matrix(1:4, 2, 2, dimnames = list( c("a","b"), c("c","d") ))
>> write.table(test, file = "test.txt", sep = "\t", quote = FALSE,
>>     col.names = NA, row.names = FALSE)
>> write.table(test, file = "test.txt", sep = "\t", quote = FALSE,
>>     col.names = NA)
>> write.table(test, file = "test.txt", sep = "\t", quote = FALSE,
>>     col.names = TRUE, row.names = FALSE)
>> write.table(test, file = "test.txt", sep = "\t", quote = FALSE,
>>     col.names = FALSE, row.names = FALSE)
> 
> 
> 

-- 
*******************************************
Dipl. Math. ETH Axel Rasche
Max-Planck-Institute for Molecular Genetics
Department Lehrach (Vertebrate Genomics)
Ihnestrasse 63-73
D-14195 Berlin-Dahlem
GERMANY

Tel. ++49-30-8413-1289
Fax  ++49-30-8413-1380



More information about the R-devel mailing list