On Fri, 27 Nov 2009, Riccardo (Jack) Lucchetti wrote:
On Fri, 27 Nov 2009, Sven Schreiber wrote:
> Allin Cottrell schrieb:
>> On Fri, 27 Nov 2009, Sven Schreiber wrote:
>>> ok() also supports lists, while missing() doesn't, is this deliberate?
>> For ok() with a list argument the return value is unambiguous:
>> it's a series with 1s for observations where no values are
>> missing, 0s otherwise. With missing() it's not so clear what it
>> should return if given a list: 1s for all missing, or for any
> Well, missing() seems to be designed as being in some sense the negation
> of ok(). So that would mean missing() is equivalent to "not ok()"; in
> this list context missing() would be 1 for *any* missing value in a
> variable. Personally this strikes me as quite intuitive and also
> practical -- I mean when would you ever be really interested if a series
> had *all* n of its values missing, as opposed to, say, "only" n-1
> But I can easily live without it, I was mainly wondering whether this
> was just an oversight.
Actually, there could be some scope for allowing list arguments in
missing(): if we had that missing(X) returns 1 when all members of X are
missing, we'd cover all possibilities:
ok(X) = 1 -> none missing
ok(X) = 0 -> some missing (could be all)
missing(X) = 1 -> all missing
missing(X) = 0 -> some ok (could be all)
Clever! (The only possible drawback: too clever for some users?)
Before seeing this, based on Sven's last contribution on this
topic, I enabled missing() with a list argument, such that
missing(list) is exactly equivalent to !ok(list).
What do people think? Jack's suggestion "adds value", with the
possible cost of the result being non-intuitive.