Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-03 Thread Greg Snow
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of David Winsemius Sent: Wednesday, December 02, 2009 3:25 PM To: Peng Yu Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] documentation of intersect() on string vector and num

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-03 Thread Peter Ehlers
Greg Snow wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of David Winsemius Sent: Wednesday, December 02, 2009 3:25 PM To: Peng Yu Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] documentation of intersect() on string vector

[R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Peng Yu
intersect(c(1,3,2),c('1','3')) [1] 1 3 Apparently, intersect() treats num as string. But this is not documented in the help. Could somebody add it in the future version of R? Also according to the help, the argument should not have duplicated elements. But I tried the following example, it

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Erik Iverson
intersect(c(1,3,2),c('1','3')) [1] 1 3 Apparently, intersect() treats num as string. But this is not documented in the help. Could somebody add it in the future version of R? This is more a general coercion feature. For example 1 == 1, see ?Comparison. Also according to the help, the

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread David Winsemius
On Dec 2, 2009, at 4:33 PM, Peng Yu wrote: intersect(c(1,3,2),c('1','3')) # note x is numeric and y is character [1] 1 3 Apparently, intersect() treats num as string. But this is not documented in the help. Could somebody add it in the future version of R? It is documented that intersect

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Erik Iverson
It is documented that intersect will return a value of that is same mode as its y argument. How could it be any more clear? Oops, this makes my previous response to this question inaccurate, apologies. __ R-help@r-project.org mailing list

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Peng Yu
On Wed, Dec 2, 2009 at 3:51 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 2, 2009, at 4:33 PM, Peng Yu wrote: intersect(c(1,3,2),c('1','3'))   # note x is numeric and y is character [1] 1 3 Apparently, intersect() treats num as string. But this is not documented in the help.

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread David Winsemius
On Dec 2, 2009, at 5:00 PM, Peng Yu wrote: On Wed, Dec 2, 2009 at 3:51 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 2, 2009, at 4:33 PM, Peng Yu wrote: intersect(c(1,3,2),c('1','3')) # note x is numeric and y is character [1] 1 3 Apparently, intersect() treats num as

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Peter Ehlers
Peng Yu wrote: On Wed, Dec 2, 2009 at 3:51 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 2, 2009, at 4:33 PM, Peng Yu wrote: intersect(c(1,3,2),c('1','3')) # note x is numeric and y is character [1] 1 3 Apparently, intersect() treats num as string. But this is not documented

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-02 Thread Peng Yu
On Wed, Dec 2, 2009 at 5:36 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Peng Yu wrote: On Wed, Dec 2, 2009 at 3:51 PM, David Winsemius dwinsem...@comcast.net wrote: On Dec 2, 2009, at 4:33 PM, Peng Yu wrote: intersect(c(1,3,2),c('1','3'))   # note x is numeric and y is character [1] 1 3