Dear All, it seems to me that the function read.spss of package foreign changed its behaviour regarding factors. I noted that in version 0.8-8 variables with value labels in SPSS were transformed in factors with the labels in alphabetic order. In version 0.8-10 they seem to be ordered preserving the order corresponding to their numerical codes in SPSS. However I could not find a description of this supposed change. Since the different behaviour seems to depend on the installed version of the foreign-package I don't know how to give a reproducible example. It also affects spss.get of the Hmisc-package, which is not surprising. I prefer the new behaviour and would like to know, if it will persist in future versions. Comments? Heinz T??chler
>>>>> "Heinz" == Heinz Tuechler <tuechler at gmx.at> >>>>> on Fri, 09 Sep 2005 01:58:29 +0200 writes:Heinz> Dear All, Heinz> it seems to me that the function read.spss of package Heinz> foreign changed its behaviour regarding factors. I Heinz> noted that in version 0.8-8 variables with value Heinz> labels in SPSS were transformed in factors with the Heinz> labels in alphabetic order. Heinz> In version 0.8-10 they seem to be ordered preserving Heinz> the order corresponding to their numerical codes in Heinz> SPSS. However I could not find a description of this Heinz> supposed change. Since the different behaviour seems Heinz> to depend on the installed version of the Heinz> foreign-package I don't know how to give a Heinz> reproducible example. It also affects spss.get of Heinz> the Hmisc-package, which is not surprising. Heinz> I prefer the new behaviour and would like to know, if Heinz> it will persist in future versions. Yes, it was on purpose. Note that the development of "foreign" is also on svn.R-project.org, and you can easily get at its 'ChangeLog' : https://svn.R-project.org/R-packages/trunk/foreign/ChangeLog where you find the relevant entry at 2005-08-15 . Regards, Martin Maechler
At 12:09 09.09.2005 +0200, Martin Maechler wrote:>>>>>> "Heinz" == Heinz Tuechler <tuechler at gmx.at> >>>>>> on Fri, 09 Sep 2005 01:58:29 +0200 writes: > > Heinz> Dear All, > Heinz> it seems to me that the function read.spss of package > Heinz> foreign changed its behaviour regarding factors. I > Heinz> noted that in version 0.8-8 variables with value > Heinz> labels in SPSS were transformed in factors with the > Heinz> labels in alphabetic order. > > Heinz> In version 0.8-10 they seem to be ordered preserving > Heinz> the order corresponding to their numerical codes in > Heinz> SPSS. However I could not find a description of this > Heinz> supposed change. Since the different behaviour seems > Heinz> to depend on the installed version of the > Heinz> foreign-package I don't know how to give a > Heinz> reproducible example. It also affects spss.get of > Heinz> the Hmisc-package, which is not surprising. > > Heinz> I prefer the new behaviour and would like to know, if > Heinz> it will persist in future versions. > >Yes, it was on purpose. > >Note that the development of "foreign" is also on >svn.R-project.org, and you can easily get at its 'ChangeLog' : > > https://svn.R-project.org/R-packages/trunk/foreign/ChangeLog > >where you find the relevant entry at 2005-08-15 . > >Regards, >Martin Maechler >Dear Martin, Thank you for your answer. As I said, I appreciate this change. The documentation does not explain precisely, how variables with labels are treated now. It only tells "If SPSS value labels are converted to factors the underlying numerical codes will not in general be the same as the SPSS numerical values, since the numerical codes in R are always 1,2,3,...". Will now the created factor levels in any case be ordered according to the order of the original numerical codes in SPSS? In general I wonder, how I could get to know such critical changes before I update a package instead of finding it out by chance. Is there a place, where a responsible R-user should look, when updating the program? Thanks again, Heinz T??chler
On Fri, 9 Sep 2005, Heinz Tuechler wrote:> Dear All, > > it seems to me that the function read.spss of package foreign changed its > behaviour regarding factors. I noted that in version 0.8-8 variables with > value labels in SPSS were transformed in factors with the labels in > alphabetic order.No, they were in the order they were stored in the file> In version 0.8-10 they seem to be ordered preserving the order > corresponding to their numerical codes in SPSS.They are now in the opposite order to their order in the file, which appears to be numerical order in SPSS (we can't be sure that this is always true since the file format is undocumented).> However I could not find a description of this supposed change.It's in the ChangeLog file in the foreign package. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle