[R] CSV format issues

Guillaume Meurice guillaume.meurice at igr.fr
Mon Jul 23 15:06:13 CEST 2012

Dear all, 

I have some encoding problem which I'm not familiar with.
Here is the case : 
I'm read data files which can have been generated from a  computer either with global settings in french or in english.

Here is an exemple ouf data file :

* English output

* French output.

In the first case, I can totally retrieve both columns, splitting each line using the comma as a separator.
In the second case, it's impossible, since the comma (in french) is also used to separate decimal. Usually, the CSV french file format add some quote, to distinguish the comma used as column separator from comma used as decimal, like the following : 


Since I'm expecting 2 numbers, I can set that if there is 3 comma, the first two number are to be gathered as well as the two lefting ones.
But in case of only two comma, which number is the floating one (I know that it is the second one, but who this is a great source of bugs ...).

the unix tools "file" returns : 
$ file P23_RD06_High\ Sensitivity\ DNA\ Assay_DE04103664_2012-06-27_11-57-29_Sample1.csv 
$ P23_RD06_High Sensitivity DNA Assay_DE04103664_2012-06-27_11-57-29_Sample1.csv: ASCII text, with CRLF line terminators

Unfortunately, the raw file doesn't contains the precious quote. So sorry to bother with this question which is not totally related to R (which I'm using). Do you know if there any facilities using R to get the data in the good format ?

Guillaume Meurice - PhD

More information about the R-help mailing list