[R] match and incomparables
McGehee, Robert
Robert.McGehee at geodecapital.com
Fri Sep 12 21:46:42 CEST 2008
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:robert.mcgehee at geodecapital.com
This e-mail, and any attachments hereto, are intended fo...{{dropped:12}}
More information about the R-help
mailing list