[RkWard-devel] SPSS test files

I. Soumpasis nono.231 at gmail.com
Sun Feb 4 15:31:17 UTC 2007


2007/2/1, Thomas Friedrichsmeier <thomas.friedrichsmeier at ruhr-uni-bochum.de
>:
>
> On Thursday 01 February 2007 18:28, you wrote:
> > I have tested the mechanism with a greek sample file. If the headers are
> > not greek (1.sav) the file is imported. If the headers are greek I take
> the
> > following error message:
> >
> >  Error in read.spss("/home/user/Desktop/12.sav", to.data.frame =
> TRUE,  :
> >     error reading system-file header
> > In addition: Warning message:
> > /home/user/Desktop/12.sav: position 0: Variable name begins with invalid
>
> > character
>
> This is deep inside the read.spss() C code. I'm afraid, there is nothing
> we
> can do about this from the RKWard side of affairs (the conversion
> mechanism I
> added simply converts all strings in the created R object, it can't access
>
> the lower levels of reading the file itself).


Well I am afraid that unfortunately this is deep inside R not read.spss like
Peter Dalgaard wrote, and it belongs in the general incombatibity with
encondings. I made some testings with R on windows, imported the spss files,
then saved workspace and tried to open it from R on linux. Here are the
outcomes. First there are the trials importing the spss files on linux and
then on windows. The files used are the followings

The following files are small examples used below:
http://users.forthnet.gr/the/isoumpasis/data/1.sav
http://users.forthnet.gr/the/isoumpasis/data/12.sav
http://users.forthnet.gr/the/isoumpasis/data/12.RData

The first file has english value labels and can be read:
> read.spss("~/Desktop/1.sav")
$VAR1
 [1] "\xf3\xf0\xdf\xf4\xe9     "       "\xf3\xf0\xdf\xf4\xe9     "
 [3] "\xf3\xf0\xdf\xf4\xe9     "       "\xf3\xf0\xdf\xf4\xe9     "
 [5] "\xf3\xf0\xdf\xf4\xe9     "       "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "
 [7] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   " "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "
 [9] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   " "\xf3\xf0\xdf\xf4\xe9     "
[11] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "

$VAR2
 [1] 5 6 7 7 5 7 3 5 6 7 8

attr(,"label.table ")
attr(,"label.table")$VAR1
NULL

attr(,"label.table")$VAR2
NULL

So we can convert this.

In file 12.sav the value labels are greek. The problem is that the file
cannot be read.

> read.spss("~/Desktop/12.sav")
Error in read.spss("~/Desktop/12.sav") : error reading system-file header
In addition: Warning message:
~/Desktop/12.sav: position 0: Variable name begins with invalid character

I also tried using use.value.labels=FALSE having the same message.

> read.spss("~/Desktop/12.sav", use.value.labels=FALSE)
Error in read.spss("~/Desktop/12.sav", use.value.labels = FALSE) :
    error reading system-file header
In addition: Warning message:
~/Desktop/12.sav: position 0: Variable name begins with invalid character

The encoding of the spss files is windows-1253 (greek).

Here is the windows part.

I imported the files in windows R with no problem. I saved the workspace as
12.RData.

And now the import to linux.

I loaded the file from linux
> load('/home/igoutsou/Desktop/12.RData')

All seems fine. Now I have two sets.
> ls()
[1] "sav11" "sav12"

sav11 comes form 1.sav and I take the same results
> sav11
$VAR1
 [1] "\xf3\xf0\xdf\xf4\xe9     "       "\xf3\xf0\xdf\xf4\xe9     "
 [3] "\xf3\xf0\xdf\xf4\xe9     "       "\xf3\xf0\xdf\xf4\xe9     "
 [5] "\xf3\xf0\xdf\xf4\xe9     "       "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "
 [7] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   " "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "
 [9] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   " "\xf3\xf0\xdf\xf4\xe9     "
[11] "\xe3\xf1\xe1\xf6\xe5\xdf\xef   "

$VAR2
 [1] 5 6 7 7 5 7 3 5 6 7 8

attr(,"label.table")
attr(,"label.table")$VAR1
NULL

attr(,"label.table")$VAR2
NULL

sav12 comes 2.sav and I cannot see it
> sav12
Error: invalid multibyte string


So if it is as I think, I do not know if there is a way for that to be fixed
even from R-developers, and if it can be fixed I do not know if they want
to. Does it make sense to ask something like this or reported as a bug? From
the answers to Thomas question on r-help list I believe that they do not
think this as bug. It is just the way it works.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20070204/ca063e19/attachment.html>


More information about the Rkward-devel mailing list