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

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Feb 17 17:17:08 CET 2009


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



More information about the R-devel mailing list