[Rd] write.csv (PR#7992)

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jul 7 20:22:53 CEST 2005


On 7/7/2005 12:38 PM, Gabor Grothendieck wrote:
> This may not be inconsistent with the documentation but it is 
> inconsistent with good practice.  Wrappers should, in general,
> set the default values, as the poster rightly indicated, and not the 
> values themselves.  Its not a coincidence that multiple people 
> have mentioned this.

The old header (which teasingly displayed some parameters and then 
ignored them) was clearly wrong, but the new one doesn't display the 
parameters.

This is pretty reasonable practice.  It's a wrapper that provides a 
subset of the functionality, but is guaranteed to produce a legal file 
of the type it claims to produce.  I don't see anything wrong with it.

Duncan Murdoch


> 
> On 7/7/05, maechler at stat.math.ethz.ch <maechler at stat.math.ethz.ch> wrote:
>> This topic already came up about a week ago on R-devel
>>  Subject: write.csv suggestion
>> 
>>  [ too bad that "R-devel" is not available via  RSiteSearch() ...
>>    {I could send you the back archives, Jon, if you are interested} ]
>> 
>> There, Brian Ripley, explained why this is not a bug, since
>> it works as documented, "CSV" files are well defined entities
>> and you can always use write.table() if you want to be flexible.
>> 
>> Brian also changed things for R-devel {to be R 2.2.x} such that
>> its help page, see
>>   http://stat.ethz.ch/R-manual/R-devel/library/base/html/write.table.html ,
>> now  has
>> 
>> > Usage:
>> >        . . . .
>> >
>> >      write.csv(...)
>> >      write.csv2(...)
>> >
>> > . . . .
>> >
>> >
>> > Arguments:
>> >        . . . .
>> >
>> >      ...: arguments to 'write.table': 'col.names', 'sep', 'dec' and
>> >           'qmethod' cannot be altered.
>> 
>> which should make the intention of the write.csv*() wrapper
>> functions a bit more clear.
>> 
>> Regards,
>> Martin Maechler, ETH Zurich
>> 
>> >>>>> "arnima" == arnima  <arnima at u.washington.edu>
>> >>>>>     on Thu,  7 Jul 2005 05:21:43 +0200 (CEST) writes:
>> 
>>    arnima> The write.csv() function is currently implemented as
>>    arnima> function (..., col.names=NA, sep=",", qmethod="double")
>>    arnima> {
>>    arnima> write.table(..., col.names=NA, sep=",", qmethod="double")
>>    arnima> }
>> 
>>    arnima> Surely, it should be
>> 
>>    arnima> function (..., col.names=NA, sep=",", qmethod="double")
>>    arnima> {
>>    arnima> write.table(..., col.names=col.names, sep=sep, qmethod=qmethod)
>>    arnima> }
>> 
>>    arnima> so that the user arguments serve a purpose. This notion is reflected in
>>    arnima> the implementation of read.csv(), for example, where sep=sep, quote=quote,
>>    arnima> etc.
>> 
>> 
>>    arnima> Arni
>> 
>>    arnima> R 2.1.1pat 2005-07-04 on WinXP
>> 
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list