Re: [Rd] Update today broke foreign package (PR#13533)

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Tue, 17 Feb 2009 17:17:08 +0100

Prof Brian Ripley wrote:
> foregin_0.8-32 was testsd aginst 2.8.1 prior to release, and I've just
> tested it again.
>
> This might be a locale issue (but I also tested in a latin1 and C
> locale), but I think it is specific to some files.

I have this with a codepage 1252 file as well. From my reply to Harry Haupt on R-help (copied here for the sake of the bug repository):

Yes, something in the logic appears to have gotten garbled.

It's in this part of read,spss:

    if (is.character(reencode)) {

        cp <- reencode
        reencode <- TRUE

    }
    else if (codepage <= 500 || codepage >= 2000) {
        attr(rval, "codepage") <- NULL
        reencode <- FALSE

    }
    else if (m <- match(cp, knownCP, 0L))

        cp <- names(knownCP)[m]

if you get to the 2nd "else if" then cp is unset. Possible the attempted match should be of codepage? But it still looks wrong: Why restrict to codepages between 500 and 2000 when knownCP contains several values above 10000???

A workaround is to set reencode="ascii" (or whatever is relevant).

> So can we have both the output of sessionInfo() and a file that causes
> the problem (it appears not to be one of the test files in the 'tests'
> subdirectory), and I'll investigate further.
>
> On Mon, 16 Feb 2009, rubin_at_msu.edu wrote:
>

>> Hi,
>>
>> I'm running R 2.8.1 on Ubuntu, and today I got updates for a couple of
>> packages, including foreign (r-cran-foreign, now at version 0.8.32).
>> Subsequent to the upgrade, attempts to invoke read.spss produce the
>> following error:
>>
>> Error in inherits(x, "factor") : object "cp" not found
>>
>> and the call to read.spss fails.  I forced a downgrade to 0.8.26, and
>> read.spss works again.
>>
>> Cheers,
>> Paul Rubin
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>

>
-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 17 Feb 2009 - 15:23:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 17 Feb 2009 - 17:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive