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

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jun 15 14:54:15 CEST 2005


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)


-- 
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



More information about the R-devel mailing list