[Rd] suggestion for "sets" tools upgrade
R. Michael Weylandt
michael.weylandt at gmail.com
Fri Feb 7 03:39:28 CET 2014
On Thu, Feb 6, 2014 at 8:31 PM, Carl Witthoft <carl at witthoft.com> wrote:
> First, let me apologize in advance if this is the wrong place to submit a
> suggestion for a change to functions in the base-R package. It never really
> occurred to me that I'd have an idea worthy of such a change.
>
> My idea is to provide an upgrade to all the "sets" tools (intersect, union,
> setdiff, setequal) that allows the user to apply them in a strictly
> algebraic style.
>
> The current tools, as well documented, remove duplicate values in the input
> vectors. This can be helpful in stats work, but is inconsistent with the
> mathematical concept of sets and set measure.
No comments about back-compatability concerns, etc. but why do you
think this is closer to the "mathematical concept of sets"? As I
learned them, sets have no repeats (or order) and other languages with
set primitives tend to agree:
python> {1,1,2,3} == {1,2,3}
True
I believe C++ calls what you're looking for a multiset (albeit with a
guarantee or orderedness).
Cheers,
Michael
More information about the R-devel
mailing list