[R-SIG-Mac] getting WriteXLS to work or else choosing file encoding of csv files output from R

Denis Chabot chabotd at globetrotter.net
Thu Dec 2 11:39:26 CET 2010


Thank you Prof. Ripley, I'll read ?file and ?iconvlist.

Denis
Le 2010-12-02 à 01:37, Prof Brian Ripley a écrit :

> On Wed, 1 Dec 2010, Denis Chabot wrote:
> 
>> Hi,
>> 
>> Until now, I have always been happy to export dataframes using write.csv2. The only drawback was than they often include accented vowels and Excel on Mac seems to ONLY be able to properly understand MacRoman encoding. So I used OpenOffice instead to open them.
>> 
>> But for the next little while, colleagues using Windows and who do not have a clue about encoding (and who do not want to know about encoding) need to use my files. My files will have to be in ISOLATIN1 encoding.
> 
> Most likely CP1252, which is the encoding used on Windows in W. European languages, not-quite-a-superset of latin1. (This is all in the R manuals, BTW.)
> 
>> It is unfortunate that the write.table family of functions does not have a FileEncoding option like the read.table function family.
> 
> But that's just syntactic sugar.
> 
>    file: either a character string naming a file or a connection open
>          for writing.  ‘""’ indicates output to the console.
> 
> See ?file for how to specify the encoding of a connection.  Very likely you want
> 
> con <- file('filename', open="w", encoding = "latin1")
> 
> (or "macroman": see ?iconvlist to find encoding names on your OS).
> 
> [...]
> 
> 
> -- 
> 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-SIG-Mac mailing list