[R] Small R documentation bug in ?anyDuplicated

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sun Dec 6 17:23:44 CET 2020


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

	[[alternative HTML version deleted]]



More information about the R-help mailing list