Skip to content
Prev 386492 / 398502 Next

Small R documentation bug in ?anyDuplicated

All:

I did not want to bother R folks for an R Bugzilla account, so I'll just
note what appears to be a documentation bug here

In R version 4.0.3, ?anyDuplicated  says:
"anyDuplicated(.) is a ?generalized? more efficient shortcut for
any(duplicated(.)).

However, anyDuplicated returns an integer and any(duplicated)  -- that is
any() -- returns a logical.  I was bitten by this by a function expecting a
logical from anyDuplicated.

I realize that there are scare quotes around "generalized", which would
indicate that anyDuplicated and any(duplicated(.)) aren't identical.
However, I believe that the line above (especially 'shortcut') leads one to
expect that both return a logical. A simple addition such as: "Note,
however, that any() returns a logical and anyDuplicated's  returns an
integer' would avoid the confusion.

Best to all,
Bert