[R] Importing data from SPSS with Arabic encoding

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 7 10:49:06 CET 2009


On Wed, 7 Jan 2009, Florent Bresson wrote:

> Dear R-users,
>
> I'm facing a problem with the import of data in R. I have a sav file that, I presume, uses some Arabic encoding (but I don't know which one) and I would like to read it with R. When I use the function read.spss (I also tried spss.get(Hmisc)), I get the following message:
>> read.spss("Hhld.sav")
> Erreur dans read.spss("Hhld.sav") :
>  erreur à la lecture de l'entête du fichier système
> De plus : Warning message:
> In read.spss("Hhld.sav") :
>  Hhld.sav : position 0 : le nom de la variable commence avec un caractère non autorisé
>
> The second and last lines can be translated into "error reading 
> system-file header" and "Hhld.sav: position 0: Variable name begins with 
> invalid character". That's why I suppose it is a problem with the 
> encoding. Does someone has an idea of the solution to my problem?

1) Please read the posting guide and supply the details you were asked to 
supply. E.g. what OS, what locale, what version of foreigh?

2) Read the help for read.spss, especially its 'reencode' argument. You 
will need to know what the encoding was, but most likely the output before 
the error which (you did not show us) told you (and would have told us).

BTW, if you start R with LANGUAGE=en set, you will get English messages to 
quote here.

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
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-help mailing list