On Fri, 12 Sep 2008, Bert Gunter wrote:

Looks like a bug to me. Compare:

A bug fixed in the R-devel version of R (because of a related problem with duplicated).

match (1:3,1:3,incom=3)
[1] 1 2 3
match (1:3,1:3,incom=2:3)
[1] 1 2 3
match (1:3,1:3,incom=1:2)
[1] NA NA  3
match (1:3,1:3,incom=1)
[1] NA  2  3

Cheers,
Bert


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Adam D. I. Kramer
Sent: Friday, September 12, 2008 3:06 PM
To: McGehee, Robert
Cc: r-help
Subject: Re: [R] match and incomparables

I can replicate this and also do not understand it.

match(1:3,1:3,incomparables=5)
[1] NA  2  3
match(1:3,1:3,incomparables=4)
[1] 1 2 3
match(1:3,1:3,incomparables=3)
[1] 1 2 3
match(1:3,1:3,incomparables=2)
[1] 1 2 3
match(1:3,1:3,incomparables=1)
[1] NA  2  3

...every other integer value for incomparables produces 1 2 and 3 for
output. I'm using R 2.7.2, self-compiled, under linux.

--Adam

On Fri, 12 Sep 2008, McGehee, Robert wrote:

Hello,
I was playing around with the newly implemented 'incomparables' argument
in 'match' and realized the argument does not behave anything like I
expected. Can someone explain what is going on here? Sorry if I'm
misreading the documentation.

match(1:3, 1:3, incomparables=1)
[1] NA  2  3  # This seems right, the 1 in 'x' is 'incomparable'

match(1:3, 1:3, incomparables=2)
[1] 1  2  3   # Shouldn't this be 1 NA 3? Why isn't the 2 incomparable?

match(1:3, 1:3, incomparables=5)
[1] NA  2  3   # Why isn't the 5 ignored?

Note from ?match:
"incomparables: a vector of values that cannot be matched. Any value in
x matching a value in this vector is assigned the nomatch value. For
historical reasons, FALSE is equivalent to NULL."

Thanks in advance!
Robert

platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          7.2
year           2008
month          08
day            25
svn rev        46428
language       R
version.string R version 2.7.2 (2008-08-25)

Robert McGehee, CFA
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Tel: 617/392-8396    Fax:617/476-6389
mailto:[EMAIL PROTECTED]



This e-mail, and any attachments hereto, are intended fo...{{dropped:12}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to