s-news
[Top] [All Lists]

Re: either this is a bug or I'm missing something...

To: "D. Mckenzie" <dmck@u.washington.edu>
Subject: Re: either this is a bug or I'm missing something...
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
Date: Tue, 11 Dec 2001 18:12:10 +0000 (GMT Standard Time)
Cc: s-news group <s-news@wubios.wustl.edu>
In-reply-to: <Pine.A41.4.33.0112110951320.74488-100000@mead1.u.washington.edu>
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


<Prev in Thread] Current Thread [Next in Thread>