# [Rd] anyDuplicated(incomp=NA) fails

Martin Maechler maechler at stat.math.ethz.ch
Sat May 9 17:24:02 CEST 2009

```>>>>> 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

```