[R] stopifnot with logical(0)

Hadley Wickham h.wickham at gmail.com
Mon Dec 14 17:45:20 CET 2015


>> I wonder if R is missing an equality operator for this case. Currently:
>>
>> * == is suboptimal because it's vectorised
>> * all.equal is suboptimal because it returns TRUE or a text string
>> * identical is suboptimal because it doesn't do common coercions
>>
>> Do we need another function (equals()?) that uses the same coercion
>> rules as == but isn't vectorised? (Like == it would only work with
>> vectors, so you'd still need identical() for (e.g.) comparing
>> environments)
>
> I don't think so.  We already have all(), so all(x == y) would do what you
> want.

But that recycles, which is what we're trying to avoid here.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list