[Rd] duplicated fails to rise correct errors (PR#13632)
waku at idi.ntnu.no
waku at idi.ntnu.no
Mon Mar 30 15:10:10 CEST 2009
Full_Name: Wacek Kusnierczyk
Version: 2.8.0 and 2.10.0 r48242
OS: Ubuntu 8.04 Linux 32 bit
Submission from: (NULL) (129.241.110.161)
In the following code:
duplicated(data.frame(), incomparables=NA)
# Error in if (!is.logical(incomparables) || incomparables)
.NotYetUsed("incomparables != FALSE") :
# missing value where TRUE/FALSE needed
the raised error is clearly not the one intended to be raised.
?duplicated says:
"
incomparables: a vector of values that cannot be compared. 'FALSE' is a
special value, meaning that all values can be compared, and
may be the only value accepted for methods other than the
default. It will be coerced internally to the same type as
'x'.
(...)
Values in 'incomparables' will never be marked as duplicated. This
is intended to be used for a fairly small set of values and will
not be efficient for a very large set.
"
However, in duplicated.data.frame (which is called when duplicated is applied to
a data frame, as above) the parameter 'incomparables' is defunct. The
documentation fails to explain this, and it might be a good idea to improve it.
In the code for duplicated.data.frame there is an attempt to intercept any use
of the parameter 'incomparables' with a value other than FALSE and to raise an
appropriate error, but this attempt fails with, e.g., incomparables=NA.
Incidentally, the attempt to intercept incomparables != FALSE fails completely
(i.e., the call to duplicated succeeds) with certain inputs:
duplicated(data.frame(logical=c(TRUE, TRUE)), incomparables=c(FALSE, TRUE))
# [1] FALSE TRUE
while
duplicated(c(TRUE, TRUE), incomparables=c(FALSE, TRUE))
# [1] FALSE FALSE
Regards,
vQ
More information about the R-devel
mailing list