[R] Re : Importing data from SPSS with Arabic encoding
Florent Bresson
f_bresson at yahoo.fr
Wed Jan 7 12:11:02 CET 2009
Thanks Brian for your help. I am sorry, I should have red the help page more carefully. I am working on Kubuntu 8.04 with R 2.8.0. The problem with the file is that I do not know what the encoding is. I do not understand what you mean with "[...] but most likely the output before the error which (you did not show us) told you (and would have told us)" since I just ran R, loaded the foreign package and then tried to get the data with the function read.spss().
I have just seen that I can get a list of the supported encodings using the function iconvlist(). Would it be possible to define some function to test which encodings fit my file?
Thanks in advance
----- Message d'origine ----
De : Prof Brian Ripley <ripley at stats.ox.ac.uk>
À : Florent Bresson <f_bresson at yahoo.fr>
Cc : r-help at stat.math.ethz.ch
Envoyé le : Mercredi, 7 Janvier 2009, 10h49mn 06s
Objet : Re: [R] Importing data from SPSS with Arabic encoding
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