On Tue, 11 Dec 2001, D. Mckenzie wrote:
> S> temp <- c(7,8,11,12,19,20,23,24)
>
> The first command produces expected behavior
>
> S> c(1:24)[match(c(1:24),temp) == "NA"]
> [1] 1 2 3 4 5 6 9 10 13 14 15 16 17 18 21 22
>
> But this one...?
>
> S> c(1:24)[c(1:24) != temp]
> [1] 1 2 3 4 5 6 7 8 9 10 13 14 15 16 17 18 19 20 21 22
>
> Is this a type of many-to-one relation that I misunderstand?
It is not a bug: you are missing something, and it's not many-one,
Your second example tests
1 != 7
2 != 8
3 != 11
...
8 != 24
8 != 7
...
using recycling.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|