From murdoch.duncan at gmail.com  Tue Sep 19 23:45:13 2017
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Tue, 19 Sep 2017 17:45:13 -0400
Subject: [Rd] what do you think about write.table(... qmethod = "excel")?
In-Reply-To: <CA+vqiLFmSb3QNTvHUM=9xzyB+y062R3CW9e7JT-McBXDcU0=_A@mail.gmail.com>
References: <CAErODj-3gXgtoDZf8LMiw=1eQZOfUeTy=-vqr1pgstW-JdBFUw@mail.gmail.com>
 <CA+vqiLFmSb3QNTvHUM=9xzyB+y062R3CW9e7JT-McBXDcU0=_A@mail.gmail.com>
Message-ID: <6c9c1135-afcc-2575-ab7e-afde81f9f913@gmail.com>

On 19/09/2017 4:10 PM, Ista Zahn wrote:
> On Tue, Sep 19, 2017 at 1:04 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:
>> Last week one of our clients reported trouble with a csv file I
>> generated with write.table.  He said that columns with quotes for
>> character variables were rejected by their data importer, which was
>> revised to match the way Microsoft Excel uses quotation marks in
>> character variables.  I explained to them that quoted character
>> variables are virtuous and wise, of course, but they say Microsoft
>> Excel CSV export no longer quotes characters unless they include
>> commas in the values.
>>
>> They showed me a CSV file from Excel that looked like this
>>
>> x1,x2,x3,x4 5 6
>> fred,barney,betty,x
>> bambam,"fred,wilma",pebbles,y
>>
>> Note how the quotes only happen on row 2 column 2. I was surprised it
>> did that, but now I have some pressure to write a csv maker that has
>> that structure.
> 
> I think you should resist that pressure.

That depends on whether this is a paying client or not.

 > It really makes no sense to
> write a .csv parser that _only_ supports .csv files created by Excel.

That's true, but if that's what they want to do, and they're willing to 
pay to be able to write files that imitate Excel, then why not do what 
they ask?

On the other hand, if they aren't willing to pay for the work, then you 
should lecture them on how silly their request is.

In any case, base R functions should not include nonsense, so this is 
not something that should go into R.

Duncan Murdoch

> If you're going to use Excel as a model, a more sensible approach
> would be to write a csv parser that supports all the formats that
> Excel itself supports; Excel of course has no problem importing
> 
> "x1","x2","x3","x4"
> "fred","barney","betty","x"
> "bambam","fred,wilma","pebbles","y"
> 
> So, seriously, tell them to just fix their csv parser. Since they seem
> hung up on Excel, it may help to point out that it does in fact import
> csv produced by write.csv without complaint.
> 
> Best,
> Ista
> 
>   Its weird, even when there are spaces in values there
>> are no quotation marks.
>>
>> Has anybody done this and verified that it matches CSV from MS Excel?
>> If I succeed will you consider a patch?
>>
>> pj
>> --
>> Paul E. Johnson   http://pj.freefaculty.org
>> Director, Center for Research Methods and Data Analysis http://crmda.ku.edu
>>
>> To write to me directly, please address me at pauljohn at ku.edu.
>>
>> ______________________________________________
>> 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
>



[Rd] what do you think about write.table(... qmethod = "excel")?
Duncan Murdoch