Re: [R] problem with all/all.equal

From: MacQueen, Don <>
Date: Wed, 13 Apr 2011 13:49:19 -0700

The help pages for identical() and all.equal() have information that will make it clear why they don't do what you want.

In the meantime, I tend to use a construct such as:


But be careful if x is not a vector.
No doubt there are other ways.


Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550

-----Original Message-----
From: Laura Smith <>
Date: Wed, 6 Apr 2011 15:09:14 -0700
To: "" <>
Subject: [R]  problem with all/all.equal

>In a function, I may have an instance in which all elements are equal.
>> x <- rep(1,5)
>> x
>[1] 1 1 1 1 1
>> identical(x)
>Error in .Internal(identical(x, y, num.eq, single.NA, :
> 'y' is missing
>> all.equal(x)
>Error in is.expression(x) : 'x' is missing
>I don't care what particular value it is, I just want to know if they are
>all equal.
>What am I doing wrong, please?
> [[alternative HTML version deleted]]
> mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Wed 13 Apr 2011 - 20:55:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Apr 2011 - 21:20:30 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive