Skip to content
Prev 47594 / 63424 Next

suggestion for "sets" tools upgrade

On 14-02-06 8:31 PM, Carl Witthoft wrote:
I understand what you are asking for, but I think this justification for 
it is just wrong.  Sets don't have duplicated elements:  an element is 
in a set, or it is not.  It can't be in the set more than once.



What I propose
This is not symmetric.  I'd like intersect(x,y,TRUE) to be the same as 
intersect(y,x,TRUE), up to re-ordering.  That's not true of your function:

 > x <- c(1,1,2,3)
 > y <- c(1,1,1,4)
 > intersect(x,y,multiple=TRUE)
[1] 1 1
 > intersect(y,x,multiple=TRUE)
[1] 1 1 1

I'd suggest that you clearly define what you mean by your functions, and 
put them in a package, along with examples where they give more useful 
results than the standard definitions.  I think the current base package 
functions match the mathematical definitions better.

Duncan Murdoch