kingsley.oteng-amoako at macquarie.com
2007-Nov-08 22:55 UTC
[Rd] Col.names parameter in write.csv (PR#10411)
Full_Name: Kingsley Oteng-Amoako Version: 2.5.1 OS: Windows 5.1.2600 (Windows XP) Submission from: (NULL) (203.185.215.144) The col.names=false in the write.csv command does not work as documented. Attempting to write a vector to a csv file without column headers does not work as documented. The col.names=false feature on the write.table command does however work and it can thus be coerced into behaving like the write.csv command - which suggests that there is a simple error with the write.csv command code.
kingsley.oteng-amoako at macquarie.com wrote:> Full_Name: Kingsley Oteng-Amoako > Version: 2.5.1 > OS: Windows 5.1.2600 (Windows XP) > Submission from: (NULL) (203.185.215.144) > > > The col.names=false in the write.csv command does not work as documented. > Attempting to write a vector to a csv file without column headers does not work > as documented. > > The col.names=false feature on the write.table command does however work and it > can thus be coerced into behaving like the write.csv command - which suggests > that there is a simple error with the write.csv command code. >No, this is exacly as documented: 'write.csv' and 'write.csv2' provide convenience wrappers for writing CSV files. They set 'sep', 'dec' and 'qmethod', and 'col.names' to 'NA' if 'row.names = TRUE' and 'TRUE' otherwise. ..... These wrappers are deliberately inflexible: they are designed to ensure that the correct conventions are used to write a valid file. Attempts to change 'col.names', 'sep', 'dec' or 'qmethod' are ignored, with a warning. (I forget whether the warning bit is new in 2.6.x, though) -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
ripley at stats.ox.ac.uk
2007-Nov-09 11:05 UTC
[Rd] Col.names parameter in write.csv (PR#10411)
On Fri, 9 Nov 2007, Peter Dalgaard wrote:> kingsley.oteng-amoako at macquarie.com wrote: >> Full_Name: Kingsley Oteng-Amoako >> Version: 2.5.1 >> OS: Windows 5.1.2600 (Windows XP) >> Submission from: (NULL) (203.185.215.144) >> >> >> The col.names=false in the write.csv command does not work as documented. >> Attempting to write a vector to a csv file without column headers does not work >> as documented. >> >> The col.names=false feature on the write.table command does however work and it >> can thus be coerced into behaving like the write.csv command - which suggests >> that there is a simple error with the write.csv command code. >> > No, this is exacly as documented: > > > 'write.csv' and 'write.csv2' provide convenience wrappers for > writing CSV files. They set 'sep', 'dec' and 'qmethod', and > 'col.names' to 'NA' if 'row.names = TRUE' and 'TRUE' otherwise. > ..... > These wrappers are deliberately inflexible: they are designed to > ensure that the correct conventions are used to write a valid > file. Attempts to change 'col.names', 'sep', 'dec' or 'qmethod' > are ignored, with a warning. > > (I forget whether the warning bit is new in 2.6.x, though)It is unchanged since June 2005, and appeared in this form in R 2.2.0. -- 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