From michael.weylandt at gmail.com  Fri Feb  7 03:39:28 2014
From: michael.weylandt at gmail.com (R. Michael Weylandt)
Date: Thu, 6 Feb 2014 21:39:28 -0500
Subject: [Rd] suggestion for "sets" tools upgrade
In-Reply-To: <52F43764.8060301@witthoft.com>
References: <52F43764.8060301@witthoft.com>
Message-ID: <CAAmySGMZBpYxs8VuZi4Z8+hEPfbct6USxpesja8m3489OOaMBw@mail.gmail.com>

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



[Rd] suggestion for "sets" tools upgrade
R. Michael Weylandt