Re: [Rd] setdiff bizarre

2009-06-02 Thread Stavros Macrakis
On Tue, Jun 2, 2009 at 1:18 PM, William Dunlap wrote: > %in% is a thin wrapper on a call to match(). Yes, as I mentioned in my email, all this is clearly documented in ? match. > match() is not a generic function (and is not documented to be one), > so it treats data.frames as lists, as their

Re: [Rd] setdiff bizarre

2009-06-02 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: [...] > I suspect it's using 'deparse()' to get the character representation. > This function is mentioned in ?as.character, but as.character.default > disappears into the infernal .Internal and I don't have time to chase > source code - it's sunny outside! > on the si

Re: [Rd] setdiff bizarre

2009-06-02 Thread William Dunlap
> > ... > > The related functions, duplicated() and unique(), do have > > row-wise data.frame methods. E.g., > >> duplicated(data.frame(x=c(1,2,2,3,3),y=letters[c(1,1,2,2,2)])) > >[1] FALSE FALSE FALSE FALSE TRUE > > Perhaps match() ought to have one also. S+'s match is generic > > and

Re: [Rd] setdiff bizarre

2009-06-02 Thread Wacek Kusnierczyk
William Dunlap wrote: > %in% is a thin wrapper on a call to match(). match() is > not a generic function (and is not documented to be one), > so it treats data.frames as lists, as their underlying > representation is a list of columns. match is documented > to convert lists to character and to th

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-06-02 Thread Barry Rowlingson
On Tue, Jun 2, 2009 at 4:13 PM, Stavros Macrakis wrote: > but simply treats the data frame as a *character* list: > >     1 %in% data.frame(a=2,b=1)  # TRUE >     '1' %in% data.frame(a=2,b=1)  # TRUE >     1 %in% data.frame(a=2:3,b=1:2) # FALSE >     1:3 %in% data.frame(a=2:4,b=1:3)  # FALSE FALS

Re: [Rd] setdiff bizarre

2009-06-02 Thread William Dunlap
- Spotfire Division wdunlap tibco.com > -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Wacek Kusnierczyk > Sent: Tuesday, June 02, 2009 9:11 AM > To: Stavros Macrakis > Cc: r-devel@r-project.org; dwinsem...@comcast.net &

Re: [Rd] setdiff bizarre

2009-06-02 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > > '1:3' %in% data.frame(a=2:4,b=1:3) # TRUE > utterly weird. so what would x have to be so that x %in% data.frame('a') # TRUE hint: '1' %in% data.frame(1) # TRUE vQ __ R-devel@r-project.org mailin

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-06-02 Thread Stavros Macrakis
On Sat, May 30, 2009 at 11:59 AM, Stavros Macrakis wrote: > Since R is object-oriented, data frame set operations should be the natural > operations for their class. There are, I suppose, two natural ways: the > column-wise (variable-wise) and the row-wise (observation-wise) one. The > row-wise

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-06-01 Thread Jason Rupert
Jay, I really appreciate all your help help. I posted to Nabble an R file and input CSV files more accurately demonstrating what I am seeing and the output I desire to achieve when I difference two dataframes. http://n2.nabble.com/Support-SetDiff-Discussion-Items...-td2999739.html It m

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-05-30 Thread G. Jay Kerns
Dear Stavros, On Sat, May 30, 2009 at 11:59 AM, Stavros Macrakis wrote: > The current implementation is column-wise... Thanks for pointing that out, and solving the mystery for me. :-) Jay __ R-devel@r-project.org mailing list https://stat.ethz.ch/m

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-05-30 Thread Stavros Macrakis
Since R is object-oriented, data frame set operations should be the natural operations for their class. There are, I suppose, two natural ways: the column-wise (variable-wise) and the row-wise (observation-wise) one. The row-wise one seems more natural and more useful to me. The current implemen

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-05-30 Thread G. Jay Kerns
On Sat, May 30, 2009 at 8:50 AM, Stavros Macrakis wrote: > It seems to me that, abstractly, a dataframe is just as > straightforwardly a sequence of tuples/observations as a vector is a > sequence of scalars. R's convention is that a 1-vector represents a > scalar, and similarly, a 1-dataframe can

Re: [Rd] setdiff bizarre (was: odd behavior out of setdiff)

2009-05-30 Thread Stavros Macrakis
It seems to me that, abstractly, a dataframe is just as straightforwardly a sequence of tuples/observations as a vector is a sequence of scalars. R's convention is that a 1-vector represents a scalar, and similarly, a 1-dataframe can represent a tuple (though it can also be represented as a list).