From maechler at stat.math.ethz.ch  Sat May  9 17:24:02 2009
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 9 May 2009 17:24:02 +0200
Subject: [Rd] anyDuplicated(incomp=NA) fails
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D70001297167@NA-PA-VBE03.na.tibco.com>
References: <77EB52C6DD32BA4D87471DCD70C8D70001297167@NA-PA-VBE03.na.tibco.com>
Message-ID: <18949.40978.656999.160462@cmath-5.math.ethz.ch>

>>>>> William Dunlap <wdunlap at tibco.com>
>>>>>     on Fri, 8 May 2009 16:16:56 -0700 writes:

    > With today's R 2.10.0(devel) I get:
    >> anyDuplicated(c(1,NA,3,NA,5), incomp=NA) # expect 0
    > Warning: stack imbalance in 'anyDuplicated', 20 then 21
    > Warning: stack imbalance in '.Internal', 19 then 20
    > Warning: stack imbalance in '{', 17 then 18 [1] 0
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=NA) # expect 5
    > Warning: stack imbalance in 'anyDuplicated', 20 then 21
    > Warning: stack imbalance in '.Internal', 19 then 20
    > Warning: stack imbalance in '{', 17 then 18 [1] 0
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=3) # expect 4
    > Warning: stack imbalance in 'anyDuplicated', 20 then 21
    > Warning: stack imbalance in '.Internal', 19 then 20
    > Warning: stack imbalance in '{', 17 then 18 [1] 0
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=c(3,NA)) # exect 0
    > Warning: stack imbalance in 'anyDuplicated', 20 then 21
    > Warning: stack imbalance in '.Internal', 19 then 20
    > Warning: stack imbalance in '{', 17 then 18 [1] 0
    >> version$svn
    > [1] "48493"

    > After applying the attached patch I get

    >> anyDuplicated(c(1,NA,3,NA,5), incomp=NA)
    > [1] 0
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=NA)
    > [1] 5
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=3)
    > [1] 4
    >> anyDuplicated(c(1,NA,3,NA,3), incomp=c(3,NA))
    > [1] 0

    > Calls to UNPROTECT() were missing an a macro definition
    > did nothing because there were no backslashes at the ends
    > of lines.  I didn't check the results very carefully.

Thank you, very much Bill!   Somewhat embarrassing...
Note that the patch "in theory" needs to be modified to only
UNPROTECT() when PROTECT() was called, which "in practice" is
always ;-), but in any case, I've slightly modified your patch
and also applied to R-patched.

Thanks once more,
Martin

    > Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap
    > tibco.com



[Rd] anyDuplicated(incomp=NA) fails
Martin Maechler